feat: generate config, load shell env vars
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
use crate::config::Configuration;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
fn generate_config() {
|
||||
|
||||
}
|
||||
pub fn generate_config() {
|
||||
let json_file = String::from("config.json");
|
||||
if !Path::new(&json_file).exists() {
|
||||
let generate = Configuration {
|
||||
api_token: Some("".to_string()),
|
||||
base_api: "/api/v1".to_string(),
|
||||
base_url: "https://gitea.com".to_string(),
|
||||
username: Some("gitea".to_string()),
|
||||
password: Some("".to_string()),
|
||||
};
|
||||
|
||||
let json = serde_json::to_string(&generate).unwrap();
|
||||
|
||||
fs::write(json_file, json).expect("Failed to write file.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user