Compare commits
4
Commits
5884d840e7
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eaf197f86e | ||
|
|
7b98fab2c8 | ||
|
|
d7ab571bbe | ||
|
|
87fcd522c4 |
@@ -34,6 +34,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
|
env:
|
||||||
|
SQLX_OFFLINE: true
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ RUN rm -rf src
|
|||||||
|
|
||||||
# Build actual app
|
# Build actual app
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
COPY .sqlx ./.sqlx
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# ── Runtime Stage ─────────────────────────────────────────────────────────────
|
# ── Runtime Stage ─────────────────────────────────────────────────────────────
|
||||||
|
|||||||
+7
-1
@@ -55,7 +55,13 @@ async fn main() {
|
|||||||
|
|
||||||
let cors = CorsLayer::new()
|
let cors = CorsLayer::new()
|
||||||
.allow_origin(cors_origin.parse::<HeaderValue>().unwrap())
|
.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([
|
.allow_headers([
|
||||||
header::CONTENT_TYPE,
|
header::CONTENT_TYPE,
|
||||||
header::AUTHORIZATION,
|
header::AUTHORIZATION,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub fn protected_router() -> Router<AppState> {
|
|||||||
.route(
|
.route(
|
||||||
"/keys/generate",
|
"/keys/generate",
|
||||||
post(apikey::create_api_key).route_layer(middleware::from_fn(|req, next| {
|
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"))
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user