mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Use vault
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -199,6 +199,7 @@ dependencies = [
|
||||
"axum-prometheus",
|
||||
"base64",
|
||||
"bytes",
|
||||
"dotenv",
|
||||
"futures",
|
||||
"once_cell",
|
||||
"reqwest",
|
||||
@@ -375,6 +376,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"
|
||||
|
||||
@@ -28,3 +28,4 @@ axum-prometheus = "0.5.0"
|
||||
base64 = "0.21.5"
|
||||
|
||||
sentry = { version = "0.32.0", features = ["debug-images"] }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
FROM rust:bullseye AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --bin books_downloader
|
||||
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/debug/books_downloader /usr/local/bin
|
||||
ENTRYPOINT ["/usr/local/bin/books_downloader"]
|
||||
@@ -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/books_downloader /usr/local/bin
|
||||
ENTRYPOINT ["/usr/local/bin/books_downloader"]
|
||||
CMD ["/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)'\''") | .[]')"
|
||||
5
scripts/start.sh
Normal file
5
scripts/start.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
cd /app
|
||||
|
||||
/env.sh > ./.env
|
||||
|
||||
exec /usr/local/bin/books_downloader
|
||||
@@ -2,6 +2,8 @@ pub mod config;
|
||||
pub mod services;
|
||||
pub mod views;
|
||||
|
||||
use dotenv::dotenv;
|
||||
|
||||
use sentry::{integrations::debug_images::DebugImagesIntegration, types::Dsn, ClientOptions};
|
||||
use std::{net::SocketAddr, str::FromStr};
|
||||
use tracing::info;
|
||||
@@ -10,6 +12,8 @@ use crate::views::get_router;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_target(false)
|
||||
.compact()
|
||||
|
||||
Reference in New Issue
Block a user