Files
Simon Wicky adbe0392ca Nym-statistics-api : Postgres schema and SSL handling + Dockerfile and GitHub action (#5817)
* add option for ssl mode

* add dockerfile and dev util

* add github workflow for nym-statistics api

* apply review comments

* ci check for version + removed checks from push
2025-06-03 12:06:00 +02:00

43 lines
1.4 KiB
Rust

use clap::Parser;
use nym_bin_common::bin_info;
use std::{path::PathBuf, sync::OnceLock};
use url::Url;
// Helper for passing LONG_VERSION to clap
fn pretty_build_info_static() -> &'static str {
static PRETTY_BUILD_INFORMATION: OnceLock<String> = OnceLock::new();
PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print())
}
#[derive(Clone, Debug, Parser)]
#[clap(author = "Nymtech", version, long_version = pretty_build_info_static(), about)]
pub(crate) struct Cli {
/// URL for the NYM API to get a network view from
#[clap(long, env = "NYM_API_URL")]
pub(crate) nym_api_url: Option<Url>,
/// HTTP port on which to run statistics api.
#[clap(long, default_value_t = 8000, env = "NYM_STATISTICS_API_HTTP_PORT")]
pub(crate) http_port: u16,
/// Connection url for the database.
#[clap(long, env = "DATABASE_URL")]
pub(crate) database_url: String,
/// Username for the database.
#[clap(long, env = "POSTGRES_USER")]
pub(crate) username: String,
/// Password for the database.
#[clap(long, env = "POSTGRES_PASSWORD")]
pub(crate) password: String,
/// PgSQL port for the database.
#[clap(long, default_value_t = 5432, env = "PGPORT")]
pub(crate) pg_port: u16,
/// SSL root certificate path. Providing this will also set the ssl mode to `Require`
#[clap(long, env = "PG_SSL_CERT")]
pub(crate) ssl_cert_path: Option<PathBuf>,
}