Skip to main content

rumtk_web_save_conf

Macro rumtk_web_save_conf 

Source
macro_rules! rumtk_web_save_conf {
    (  ) => { ... };
    ( $path:expr ) => { ... };
}
Expand description

Serializes AppConf default contents and saves it to a file on disk at a specified path or relative to the current working directory. This is done to pre-craft a default configuration skeleton so a consumer of the framework can simply update that file before testing and shipping to production.

By default, we generate the skeleton in ./app.json.

ยงExample

use std::fs;
use rumtk_core::rumtk_new_lock;
use rumtk_web::rumtk_web_save_conf;
use rumtk_core::strings::RUMString;

let path = "./test_conf.json";

if fs::exists(&path).unwrap() {
    fs::remove_file(&path).unwrap();
}

assert!(!fs::exists(&path).unwrap(), "File was not deleted as expected!");

rumtk_web_save_conf!(&path);

assert!(fs::exists(&path).unwrap(), "File was not created as expected!");

if fs::exists(&path).unwrap() {
    fs::remove_file(&path).unwrap();
}