Add private network blocking env flag

This commit is contained in:
ldm0
2026-08-11 20:12:18 +08:00
committed by Donough Liu
parent a73f60d08a
commit fa2d3f00d5
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -337,7 +337,7 @@ pub struct CommonArgs {
#[arg(long)]
pub document_start_script_file: Vec<String>,
#[arg(long)]
#[arg(long, env = "MOLI_BLOCK_PRIVATE_NETWORKS")]
pub block_private_networks: bool,
#[arg(long)]
+9 -1
View File
@@ -997,6 +997,7 @@ fn env_flags_are_fallbacks_and_cli_flags_take_priority() {
.env("MOLI_TEST_ENV_FLAG_CASE", case)
.env("MOLI_LAYOUT", layout)
.env("MOLI_RESOURCE", resource)
.env("MOLI_BLOCK_PRIVATE_NETWORKS", resource)
.output()
.unwrap();
@@ -1016,7 +1017,13 @@ fn parse_env_flags_in_child_process() {
};
let args = if case == "cli-overrides-env" {
vec!["moli", "serve", "--layout", "--resource"]
vec![
"moli",
"serve",
"--layout",
"--resource",
"--block-private-networks",
]
} else {
vec!["moli", "serve"]
};
@@ -1028,6 +1035,7 @@ fn parse_env_flags_in_child_process() {
assert_eq!(args.common.layout, expected);
assert_eq!(args.common.resource, expected);
assert_eq!(args.common.block_private_networks, expected);
}
#[test]