Skip to content

Commit 0545a72

Browse files
committed
feat: fixed messages and renamed config vars
1 parent 1fbecce commit 0545a72

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

config/maximal-config-example.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ port = 7300
3535
postgres_url = "postgres://postgres@postgres:5432/postgres"
3636
# You can also use the following fields to specify the connection details separately.
3737
# either use `postgres_url` or the following fields.
38-
postgres_host = "postgres-host"
39-
postgres_port = 5432
40-
postgres_user = "user"
41-
postgres_password = "pwd"
42-
postgress_db = "postgres"
38+
host = "postgres-host"
39+
port = 5432
40+
user = "user"
41+
password = "pwd"
42+
database = "postgres"
4343

4444
[graph_node]
4545
# URL to your graph-node's query endpoint

config/minimal-config-example.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ operator_mnemonic = "celery smart tip orange scare van steel radio dragon joy al
2121
postgres_url = "postgres://postgres@postgres:5432/postgres"
2222
# You can also use the following fields to specify the connection details separately.
2323
# either use `postgres_url` or the following fields.
24-
postgres_host = "postgres-host"
25-
postgres_port = 5432
26-
postgres_user = "user"
27-
postgres_password = "pwd"
28-
postgress_db = "postgres"
24+
host = "postgres-host"
25+
port = 5432
26+
user = "user"
27+
password = "pwd"
28+
database = "postgres"
2929

3030
[graph_node]
3131
# URL to your graph-node's query endpoint

config/src/config.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ pub enum DatabaseConfig {
161161
},
162162
}
163163
impl DatabaseConfig {
164-
pub fn get_formated_postgres_url(&self) -> Url {
164+
pub fn get_formated_postgres_url(self) -> Url {
165165
match self {
166-
DatabaseConfig::PostgresUrl { postgres_url } => postgres_url.clone(),
166+
DatabaseConfig::PostgresUrl { postgres_url } => postgres_url,
167167
DatabaseConfig::PostgresVars {
168168
host,
169169
port,
@@ -172,11 +172,14 @@ impl DatabaseConfig {
172172
database,
173173
} => {
174174
let postgres_url_str = format!("postgres://{}@{}/{}", user, host, database);
175-
let mut postgres_url = Url::parse(&postgres_url_str).unwrap();
175+
let mut postgres_url =
176+
Url::parse(&postgres_url_str).expect("Failed to parse database_url");
176177
postgres_url
177178
.set_password(password.as_deref())
178-
.expect("url is wrong");
179-
postgres_url.set_port(*port).expect("url is wrong");
179+
.expect("Failed to set password for database");
180+
postgres_url
181+
.set_port(port)
182+
.expect("Failed to set port for database");
180183
postgres_url
181184
}
182185
}

0 commit comments

Comments
 (0)