mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 07:45:35 +01:00
Add vault
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -346,6 +346,12 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenv"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
@@ -883,6 +889,7 @@ dependencies = [
|
||||
"axum",
|
||||
"chrono",
|
||||
"deadpool-postgres",
|
||||
"dotenv",
|
||||
"futures",
|
||||
"lazy_static",
|
||||
"maplit",
|
||||
|
||||
@@ -28,3 +28,4 @@ maplit = "1.0.2"
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"]}
|
||||
tower-http = { version = "0.5.0", features = ["trace"] }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
@@ -15,7 +15,10 @@ RUN apt-get update \
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
COPY ./scripts/*.sh /
|
||||
RUN chmod +x /*.sh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/release/library_updater /usr/local/bin
|
||||
ENTRYPOINT ["/usr/local/bin/library_updater"]
|
||||
ENTRYPOINT ["/start.sh"]
|
||||
|
||||
7
scripts/env.sh
Normal file
7
scripts/env.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
response=`curl -X 'GET' "https://$VAULT_HOST/v1/$VAULT_SECRET_PATH" -s \
|
||||
-H 'accept: application/json' \
|
||||
-H "X-Vault-Token: $VAULT_TOKEN"`
|
||||
|
||||
echo "$(echo "$response" | jq -r '.data.data | to_entries | map("\(.key)='\''\(.value)'\''") | .[]')"
|
||||
@@ -1,11 +0,0 @@
|
||||
import os
|
||||
|
||||
import httpx
|
||||
|
||||
|
||||
response = httpx.get(
|
||||
"http://localhost:8080/healthcheck",
|
||||
headers={"Authorization": os.environ["API_KEY"]},
|
||||
)
|
||||
print(f"HEALTHCHECK STATUS: {response.status_code}")
|
||||
exit(0 if response.status_code == 200 else 1)
|
||||
7
scripts/start.sh
Normal file
7
scripts/start.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
cd /app
|
||||
|
||||
/env.sh > ./.env
|
||||
|
||||
exec /usr/local/bin/library_updater
|
||||
@@ -7,6 +7,7 @@ pub mod updater;
|
||||
pub mod utils;
|
||||
|
||||
use axum::{http::HeaderMap, routing::post, Router};
|
||||
use dotenv::dotenv;
|
||||
use sentry::{integrations::debug_images::DebugImagesIntegration, types::Dsn, ClientOptions};
|
||||
use std::{net::SocketAddr, str::FromStr};
|
||||
use tower_http::trace::{self, TraceLayer};
|
||||
@@ -54,6 +55,8 @@ async fn start_app() {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_target(false)
|
||||
.compact()
|
||||
|
||||
Reference in New Issue
Block a user