Añade configuración y conexión a la base de datos
This commit is contained in:
parent
b6dd473578
commit
76785af4dc
13 changed files with 210 additions and 83 deletions
|
|
@ -87,6 +87,16 @@ pub struct Log {
|
|||
pub format : String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Database {
|
||||
pub db_name : String,
|
||||
pub db_user : String,
|
||||
pub db_pass : String,
|
||||
pub db_host : String,
|
||||
pub db_port : u16,
|
||||
pub max_pool_size : u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Webserver {
|
||||
pub bind_address : String,
|
||||
|
|
@ -97,6 +107,7 @@ pub struct Webserver {
|
|||
pub struct Settings {
|
||||
pub app : App,
|
||||
pub log : Log,
|
||||
pub database : Database,
|
||||
pub webserver : Webserver,
|
||||
}
|
||||
|
||||
|
|
@ -121,6 +132,14 @@ Ajustes globales y valores predeterminados para las secciones *\[app\]*,
|
|||
"log.prefix" => "tracing.log",
|
||||
"log.format" => "json",
|
||||
|
||||
// [database]
|
||||
"database.db_name" => "dbname",
|
||||
"database.db_user" => "dbuser",
|
||||
"database.db_pass" => "dbpass",
|
||||
"database.db_host" => "localhost",
|
||||
"database.db_port" => 0,
|
||||
"database.max_pool_size" => 5,
|
||||
|
||||
// [webserver]
|
||||
"webserver.bind_address" => "localhost",
|
||||
"webserver.bind_port" => 8088
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue