MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / Config

Class Config

ch_10/src/config.rs:7–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#[derive(Parser, Debug)]
6#[command(author, version, about, long_about = None)]
7pub struct Config {
8 /// Which errors we want to log (info, warn or error)
9 #[arg(short, long, default_value = "warn")]
10 pub log_level: String,
11 /// Which PORT the server is listening to
12 #[arg(short, long, default_value = "8080")]
13 pub port: u16,
14 /// Database user
15 #[arg(long, default_value = "username")]
16 pub db_user: String,
17 /// Database user
18 #[arg(long)]
19 pub db_password: String,
20 /// URL for the postgres database
21 #[arg(long, default_value = "localhost")]
22 pub db_host: String,
23 /// PORT number for the database connection
24 #[arg(long, default_value = "5432")]
25 pub db_port: u16,
26 /// Database name
27 #[arg(long, default_value = "rustwebdev")]
28 pub db_name: String,
29}
30
31impl Config {
32 pub fn new() -> Result<Config, handle_errors::Error> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected