cleanup internal env vars

This commit is contained in:
Brandon Thomas committed 2020-05-31 20:11:19 -04:00
1 parent 2e622de648
commit 488a9739f9
1 file changed
+12 -12
+12 -12
View File
@@ -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::<usize>(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::<usize>(ENV_NUM_WORKERS, DEFAULT_NUM_WORKERS)?;
let database_url = get_env_string(ENV_DATABASE_URL, DEFAULT_DATABASE_URL);
info!("Asset directory: {}", asset_directory);