Compare commits

..
10 Commits
Author SHA1 Message Date
LucasDLTG eaf197f86e feat: secure genrate key endpoint
CI / Rust CI (push) Successful in 2m9s
Publish & Deploy / Build and Push to Registry (push) Successful in 28s
Publish & Deploy / Deploy via SSH (push) Successful in 18s
2026-05-07 20:59:01 +02:00
LucasDLTG 7b98fab2c8 fix: add cors option http
CI / Rust CI (push) Successful in 2m8s
Publish & Deploy / Build and Push to Registry (push) Successful in 28s
Publish & Deploy / Deploy via SSH (push) Successful in 17s
2026-05-07 20:12:24 +02:00
LucasDLTG d7ab571bbe fix: release ci with sqlx
CI / Rust CI (push) Successful in 2m8s
Publish & Deploy / Build and Push to Registry (push) Successful in 27s
Publish & Deploy / Deploy via SSH (push) Successful in 7s
2026-05-07 19:56:17 +02:00
LucasDLTG 87fcd522c4 fix: release ci with sqlx
CI / Rust CI (push) Successful in 2m9s
Publish & Deploy / Build and Push to Registry (push) Failing after 14s
Publish & Deploy / Deploy via SSH (push) Has been skipped
2026-05-07 19:50:37 +02:00
LucasDLTG 5884d840e7 fix: cargo audit no fatal
CI / Rust CI (push) Successful in 5m12s
Publish & Deploy / Build and Push to Registry (push) Failing after 14s
Publish & Deploy / Deploy via SSH (push) Has been skipped
2026-05-07 19:43:20 +02:00
LucasDLTG a631b8cd1e feat: add .sqlx 2026-05-07 19:39:50 +02:00
LucasDLTG 8bc5200f77 feat: readme 2026-05-07 19:36:44 +02:00
LucasDLTG 8878dbb454 fix: pre commit
CI / Rust CI (push) Failing after 1m12s
2026-05-07 19:34:43 +02:00
LucasDLTG ecf275dedd feat: readme 2026-05-07 19:33:25 +02:00
LucasDLTG a6b9ee5b09 fix: ci with sqlx
CI / Rust CI (push) Failing after 1m10s
Publish & Deploy / Build and Push to Registry (push) Failing after 13s
Publish & Deploy / Deploy via SSH (push) Has been skipped
2026-05-07 19:17:01 +02:00
10 changed files with 97 additions and 6 deletions
+2
View File
@@ -33,6 +33,8 @@ jobs:
${{ runner.os }}-cargo-
- name: Run tests
env:
SQLX_OFFLINE: true
run: cargo test --workspace --verbose --all
- name: Run Clippy (linter)
+2
View File
@@ -34,6 +34,8 @@ jobs:
- name: Build and Push
uses: https://github.com/docker/build-push-action@v5
env:
SQLX_OFFLINE: true
with:
context: .
push: true
+11 -4
View File
@@ -12,30 +12,37 @@ repos:
- id: clippy
name: clippy
entry: cargo clippy -- -D warnings
entry: bash -c 'SQLX_OFFLINE=true cargo clippy -- -D warnings'
language: system
types: [rust]
pass_filenames: false
stages: [pre-commit]
# ─────────────── PRE-PUSH (heavy checks) ───────────────
- id: sqlx-prepare-check
name: sqlx prepare check
entry: cargo sqlx prepare --check
language: system
pass_filenames: false
stages: [pre-push]
- id: test
name: cargo test
entry: cargo test --all
entry: bash -c 'SQLX_OFFLINE=true cargo test --all'
language: system
pass_filenames: false
stages: [pre-push]
- id: build
name: cargo build release
entry: cargo build --release
entry: bash -c 'SQLX_OFFLINE=true cargo build --release'
language: system
pass_filenames: false
stages: [pre-push]
- id: audit
name: cargo audit
entry: cargo audit
entry: bash -c 'cargo audit || echo "cargo audit failed (non-blocking)"'
language: system
pass_filenames: false
stages: [pre-push]
@@ -0,0 +1,17 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO auth.api_key (key_hash, name, created_by, scopes)\n VALUES ($1, $2, $3, $4)\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text",
"Uuid",
"TextArray"
]
},
"nullable": []
},
"hash": "14b38b0f3fca61893dc6e036dc68f643a724b729f73f8308ae0b3a70d87dc5de"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO auth.app_user (id)\n VALUES ($1)\n ON CONFLICT (id) DO NOTHING\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid"
]
},
"nullable": []
},
"hash": "70117c16fc3efeebbcb40838d13dd427bf246f4eabd3e335077f47a7aa7882e4"
}
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE auth.api_key\n SET last_used_at = now()\n WHERE id = $1\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid"
]
},
"nullable": []
},
"hash": "ab03067777ea2a8f12c3dec5cf99caf4ad700008d892a33c25408c34bebab83c"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT u.id AS user_id, ak.id as key_id\n FROM auth.api_key ak\n JOIN auth.app_user u ON u.id = ak.created_by\n WHERE ak.key_hash = $1\n AND ak.revoked_at IS NULL\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "user_id",
"type_info": "Uuid"
},
{
"ordinal": 1,
"name": "key_id",
"type_info": "Uuid"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false
]
},
"hash": "c0816078de6c25d441752500b9307900ff3d6c7781ebd9c0d8b47031539d8bdf"
}
+1
View File
@@ -17,6 +17,7 @@ RUN rm -rf src
# Build actual app
COPY src ./src
COPY .sqlx ./.sqlx
RUN cargo build --release
# ── Runtime Stage ─────────────────────────────────────────────────────────────
+7 -1
View File
@@ -55,7 +55,13 @@ async fn main() {
let cors = CorsLayer::new()
.allow_origin(cors_origin.parse::<HeaderValue>().unwrap())
.allow_methods([Method::GET, Method::POST, Method::PUT, Method::DELETE])
.allow_methods([
Method::GET,
Method::POST,
Method::PUT,
Method::DELETE,
Method::OPTIONS,
])
.allow_headers([
header::CONTENT_TYPE,
header::AUTHORIZATION,
+1 -1
View File
@@ -27,7 +27,7 @@ pub fn protected_router() -> Router<AppState> {
.route(
"/keys/generate",
post(apikey::create_api_key).route_layer(middleware::from_fn(|req, next| {
require_roles(req, next, None, None)
require_roles(req, next, None, Some("admin"))
})),
)
}