Using .env config
This commit is contained in:
@@ -4,7 +4,11 @@ use voxa_server::{ServerConfig, utils::vfs};
|
||||
|
||||
fn main() -> voxa_server::Result<()> {
|
||||
let root = PathBuf::from("./");
|
||||
let config: ServerConfig = vfs::read_config(&root.join("config.json"))?;
|
||||
let config: ServerConfig = if let Ok(env_config) = std::env::var("VX_CONFIG") {
|
||||
ServerConfig::from_str(&env_config)?
|
||||
} else {
|
||||
vfs::read_config(&root.join("config.json"))?
|
||||
};
|
||||
let server = config.build(&root);
|
||||
server.add_plugin(Box::new(test_plugin::MyPlugin::default()));
|
||||
server.run()?;
|
||||
|
||||
Reference in New Issue
Block a user