diff --git a/tts_service/src/main.rs b/tts_service/src/main.rs index 83145795c0..2104923312 100644 --- a/tts_service/src/main.rs +++ b/tts_service/src/main.rs @@ -42,19 +42,19 @@ use crate::model::model_cache::ModelCache; use crate::database::connector::DatabaseConnector; use crate::endpoints::sentences::get_sentences; -const BIND_ADDRESS : &'static str = "BIND_ADDRESS"; -const ASSET_DIRECTORY : &'static str = "ASSET_DIRECTORY"; -const MODEL_CONFIG_FILE : &'static str = "MODEL_CONFIG_FILE"; +const ENV_ASSET_DIRECTORY: &'static str = "ASSET_DIRECTORY"; +const ENV_BIND_ADDRESS: &'static str = "BIND_ADDRESS"; const ENV_DATABASE_URL : &'static str = "DATABASE_URL"; -const ENV_NUMBER_WORKERS : &'static str = "NUM_WORKERS"; +const ENV_MODEL_CONFIG_FILE: &'static str = "MODEL_CONFIG_FILE"; +const ENV_NUM_WORKERS: &'static str = "NUM_WORKERS"; const ENV_RUST_LOG : &'static str = "RUST_LOG"; -const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345"; const DEFAULT_ASSET_DIRECTORY : &'static str = "/home/bt/dev/voder/tts_frontend/build"; -const DEFAULT_MODEL_CONFIG_FILE: &'static str = "models.toml"; -const DEFAULT_RUST_LOG: &'static str = "debug,actix_web=info"; -const DEFAULT_NUM_WORKERS : usize = 4; +const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345"; const DEFAULT_DATABASE_URL : &'static str = "mysql://root:root@localhost/mumble"; +const DEFAULT_MODEL_CONFIG_FILE: &'static str = "models.toml"; +const DEFAULT_NUM_WORKERS : usize = 4; +const DEFAULT_RUST_LOG: &'static str = "debug,actix_web=info"; /** State that is easy to pass between handlers. */ pub struct AppState { @@ -112,10 +112,10 @@ pub fn main() -> AnyhowResult<()> { env_logger::init(); - let bind_address = get_env_string(BIND_ADDRESS, DEFAULT_BIND_ADDRESS); - let asset_directory = get_env_string(ASSET_DIRECTORY, DEFAULT_ASSET_DIRECTORY); - let model_config_file = get_env_string(MODEL_CONFIG_FILE, DEFAULT_MODEL_CONFIG_FILE); - let num_workers = get_env_num::(ENV_NUMBER_WORKERS, DEFAULT_NUM_WORKERS)?; + let bind_address = get_env_string(ENV_BIND_ADDRESS, DEFAULT_BIND_ADDRESS); + let asset_directory = get_env_string(ENV_ASSET_DIRECTORY, DEFAULT_ASSET_DIRECTORY); + let model_config_file = get_env_string(ENV_MODEL_CONFIG_FILE, DEFAULT_MODEL_CONFIG_FILE); + let num_workers = get_env_num::(ENV_NUM_WORKERS, DEFAULT_NUM_WORKERS)?; let database_url = get_env_string(ENV_DATABASE_URL, DEFAULT_DATABASE_URL); info!("Asset directory: {}", asset_directory);