mirror of
https://github.com/jht5945/buildj.git
synced 2025-12-28 01:31:35 +08:00
add BUILDJ_AUTH_TOKEN
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
|
||||
use std::env;
|
||||
use rust_util::util_env::*;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref VERBOSE: bool = is_env_on("BUILDJ_VERBOSE");
|
||||
pub static ref NOAUTH: bool = is_env_on("BUILDJ_NOAUTH");
|
||||
pub static ref NOBUILDIN: bool = is_env_on("BUILDJ_NOBUILDIN");
|
||||
pub static ref AUTH_TOKEN: Option<String> = env::var("BUILDJ_AUTH_TOKEN").ok();
|
||||
}
|
||||
|
||||
pub fn print_usage() {
|
||||
|
||||
@@ -145,6 +145,10 @@ pub fn get_extract_dir_name_by_file_name(file_name: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
pub fn get_tool_package_secret() -> XResult<String> {
|
||||
if (*AUTH_TOKEN).is_some() {
|
||||
return Ok((*AUTH_TOKEN).as_ref().unwrap().clone());
|
||||
}
|
||||
|
||||
let standard_config_file = get_user_home_dir(STANDARD_CONFIG_JSON)?;
|
||||
let standard_config_json = fs::read_to_string(&standard_config_file)?;
|
||||
let standard_config_object = json::parse(&standard_config_json)?;
|
||||
|
||||
Reference in New Issue
Block a user