Skip to content

Commit 72a6aee

Browse files
committed
feat: Support declaring vars from env variables
1 parent fececdd commit 72a6aee

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ You can define and use variables in `path` & `host`.
6767
"x64"
6868
]
6969
}
70+
},
71+
"feature_or_default": {
72+
"default": "default",
73+
"value": [
74+
"env",
75+
"YOUR_ENV_NAME"
76+
]
7077
}
7178
},
7279
}

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ function resolveVariableValue(value: any): string | false {
5858
}
5959
}
6060

61+
if (Array.isArray(value) && value.length == 2) {
62+
const [valueName, env_name] = value;
63+
if (valueName === "env") {
64+
return process.env[env_name] || false;
65+
}
66+
}
67+
6168
if (value === "libc") {
6269
return resolveLibc();
6370
}

0 commit comments

Comments
 (0)