Skip to content

Commit

Permalink
max attempts renamed to max_db_attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
enola-dkfz committed Oct 10, 2024
1 parent 20c6c18 commit 9ecd9a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ POSTGRES_CONNECTION_STRING = "postgresql://postgres:Test.123@localhost:5432/post

Additionally when using Postgres this optional variable can be set:
```bash
MAX_ATTEMPTS = "8" # Max number of attempts to connect to the database, default value: 8
MAX_DB_ATTEMPTS = "8" # Max number of attempts to connect to the database, default value: 8
```

Obfuscating zero counts is by default switched off. To enable obfuscating zero counts, set the env. variable `OBFUSCATE_ZERO`.
Expand Down
6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct CliArgs {
/// Max number of attempts to connect to the database
#[cfg(feature = "query-sql")]
#[clap(long, env, value_parser, default_value = "8")]
max_attempts: u32,
max_db_attempts: u32,
}

pub(crate) struct Config {
Expand Down Expand Up @@ -201,7 +201,7 @@ pub(crate) struct Config {
#[cfg(feature = "query-sql")]
pub postgres_connection_string: Option<String>,
#[cfg(feature = "query-sql")]
pub max_attempts: u32,
pub max_db_attempts: u32,
}

impl Config {
Expand Down Expand Up @@ -246,7 +246,7 @@ impl Config {
#[cfg(feature = "query-sql")]
postgres_connection_string: cli_args.postgres_connection_string,
#[cfg(feature = "query-sql")]
max_attempts: cli_args.max_attempts,
max_db_attempts: cli_args.max_db_attempts,
client,
};
Ok(config)
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async fn get_db_pool() -> Result<Option<DbPool>,ExitCode> {
#[cfg(feature = "query-sql")]
async fn get_db_pool() -> Result<Option<DbPool>,ExitCode> {
if let Some(connection_string) = CONFIG.postgres_connection_string.clone() {
match db::get_pg_connection_pool(&connection_string, CONFIG.max_attempts).await {
match db::get_pg_connection_pool(&connection_string, CONFIG.max_db_attempts).await {
Err(e) => {
error!("Error connecting to database: {}", e);
Err(ExitCode::from(8))
Expand Down

0 comments on commit 9ecd9a5

Please sign in to comment.