aboutsummaryrefslogtreecommitdiff
path: root/src/garage/main.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-01-16 11:33:27 +0000
committerAlex <alex@adnab.me>2024-01-16 11:33:27 +0000
commit707d85f60293099e75e5aa821c0ee66796fdaa5b (patch)
tree09f2dbdd30f8464c2d1f27532a690a46258aedb9 /src/garage/main.rs
parentd91a1de7315373271bce72088a4c73007f2154e8 (diff)
parent4c5be79b8015510618ad1df7451c50e3f2659978 (diff)
downloadgarage-707d85f60293099e75e5aa821c0ee66796fdaa5b.tar.gz
garage-707d85f60293099e75e5aa821c0ee66796fdaa5b.zip
Merge pull request 'sync garage v0.9 with garage v0.8' (#657) from sync-08-09 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/657
Diffstat (limited to 'src/garage/main.rs')
-rw-r--r--src/garage/main.rs34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs
index 66403d05..9f9eefed 100644
--- a/src/garage/main.rs
+++ b/src/garage/main.rs
@@ -7,6 +7,7 @@ extern crate tracing;
mod admin;
mod cli;
mod repair;
+mod secrets;
mod server;
#[cfg(feature = "telemetry-otlp")]
mod tracing_setup;
@@ -28,7 +29,6 @@ use structopt::StructOpt;
use netapp::util::parse_and_resolve_peer_addr;
use netapp::NetworkKey;
-use garage_util::config::Config;
use garage_util::error::*;
use garage_rpc::system::*;
@@ -38,6 +38,7 @@ use garage_model::helper::error::Error as HelperError;
use admin::*;
use cli::*;
+use secrets::Secrets;
#[derive(StructOpt, Debug)]
#[structopt(
@@ -66,24 +67,6 @@ struct Opt {
cmd: Command,
}
-#[derive(StructOpt, Debug)]
-pub struct Secrets {
- /// RPC secret network key, used to replace rpc_secret in config.toml when running the
- /// daemon or doing admin operations
- #[structopt(short = "s", long = "rpc-secret", env = "GARAGE_RPC_SECRET")]
- pub rpc_secret: Option<String>,
-
- /// Metrics API authentication token, replaces admin.metrics_token in config.toml when
- /// running the Garage daemon
- #[structopt(long = "admin-token", env = "GARAGE_ADMIN_TOKEN")]
- pub admin_token: Option<String>,
-
- /// Metrics API authentication token, replaces admin.metrics_token in config.toml when
- /// running the Garage daemon
- #[structopt(long = "metrics-token", env = "GARAGE_METRICS_TOKEN")]
- pub metrics_token: Option<String>,
-}
-
#[tokio::main]
async fn main() {
// Initialize version and features info
@@ -261,16 +244,3 @@ async fn cli_command(opt: Opt) -> Result<(), Error> {
Ok(x) => Ok(x),
}
}
-
-fn fill_secrets(mut config: Config, secrets: Secrets) -> Config {
- if secrets.rpc_secret.is_some() {
- config.rpc_secret = secrets.rpc_secret;
- }
- if secrets.admin_token.is_some() {
- config.admin.admin_token = secrets.admin_token;
- }
- if secrets.metrics_token.is_some() {
- config.admin.metrics_token = secrets.metrics_token;
- }
- config
-}