feat: rename env names
This commit is contained in:
@@ -13,9 +13,9 @@ Environment variables
|
|||||||
| Env Key | Env Value |
|
| Env Key | Env Value |
|
||||||
|---------------|----------------------------------------------------------------|
|
|---------------|----------------------------------------------------------------|
|
||||||
| `HOME` | User home, default by OS system |
|
| `HOME` | User home, default by OS system |
|
||||||
| `SKIP_CACHE` | Skip compiled cached file , turn on `true`, `yes`, `on` or `1` |
|
| `RUNRS_SKIP_CACHE` | Skip compiled cached file , turn on `true`, `yes`, `on` or `1` |
|
||||||
| `RUST_SCRIPT` | `rust_script` command line bin file |
|
| `RUNRS_RUST_SCRIPT` | `rust_script` command line bin file |
|
||||||
| `MAX_SCRIPT_LEN` | Max script length |
|
| `RUNRS_MAX_SCRIPT_LEN` | Max script length |
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_script_command(rust_script: PathBuf, script_file: &str, script_sha256: &str, cache_script_bin_name: &str) -> Command {
|
fn build_script_command(rust_script: PathBuf, script_file: &str, script_sha256: &str, cache_script_bin_name: &str) -> Command {
|
||||||
let skip_cache = is_env_on("SKIP_CACHE");
|
let skip_cache = is_env_on("RUNRS_SKIP_CACHE");
|
||||||
let cache_script_bin_name_exists = fs::metadata(&cache_script_bin_name).is_ok();
|
let cache_script_bin_name_exists = fs::metadata(&cache_script_bin_name).is_ok();
|
||||||
debugging!("Bin name: {} {}exists", cache_script_bin_name, iff!(cache_script_bin_name_exists, "", "not "));
|
debugging!("Bin name: {} {}exists", cache_script_bin_name, iff!(cache_script_bin_name_exists, "", "not "));
|
||||||
if !skip_cache && cache_script_bin_name_exists {
|
if !skip_cache && cache_script_bin_name_exists {
|
||||||
@@ -98,7 +98,7 @@ runrs <script.rs> [arguments]
|
|||||||
|
|
||||||
fn read_file_and_digest(script_file: &str) -> (String, String) {
|
fn read_file_and_digest(script_file: &str) -> (String, String) {
|
||||||
let default_max_script_len = 1024 * 1024;
|
let default_max_script_len = 1024 * 1024;
|
||||||
let max_script_len: u64 = env::var("MAX_SCRIPT_LEN")
|
let max_script_len: u64 = env::var("RUNRS_MAX_SCRIPT_LEN")
|
||||||
.map(|len| len.parse().unwrap_or_else(|| default_max_script_len)).unwrap_or_else(|| default_max_script_len);
|
.map(|len| len.parse().unwrap_or_else(|| default_max_script_len)).unwrap_or_else(|| default_max_script_len);
|
||||||
match fs::metadata(script_file) {
|
match fs::metadata(script_file) {
|
||||||
Err(_) => failure_and_exit!("Script file not exists: {}", script_file),
|
Err(_) => failure_and_exit!("Script file not exists: {}", script_file),
|
||||||
@@ -117,7 +117,7 @@ fn read_file_and_digest(script_file: &str) -> (String, String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_run_script_bin_name(home: &str) -> PathBuf {
|
fn get_run_script_bin_name(home: &str) -> PathBuf {
|
||||||
if let Ok(rust_script) = env::var("RUST_SCRIPT") {
|
if let Ok(rust_script) = env::var("RUNRS_RUST_SCRIPT") {
|
||||||
let rust_script_path_buf = PathBuf::from(&rust_script);
|
let rust_script_path_buf = PathBuf::from(&rust_script);
|
||||||
if !rust_script_path_buf.exists() {
|
if !rust_script_path_buf.exists() {
|
||||||
warning!("RUST_SCRIPT={} not exists", &rust_script);
|
warning!("RUST_SCRIPT={} not exists", &rust_script);
|
||||||
|
|||||||
Reference in New Issue
Block a user