fix .env support
Some checks are pending
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run

This commit is contained in:
Namhyeon Go 2024-10-14 04:52:22 +09:00
parent 94afeb406a
commit b93c6cd48b
2 changed files with 13 additions and 2 deletions

View File

@ -2,6 +2,9 @@
// https://github.com/gnh1201/welsonjs
var SYS = require("lib/system");
// env
var env = {};
function main(args) {
console.log("WelsonJS.Service required.");
}
@ -11,7 +14,14 @@ function getDeviceID() {
}
function onServiceStart(args) {
return "onServiceStart recevied. " + args.join(', ');
// load the environment file
FILE.loadEnvFromArgs(args, function(envConfig) {
if ("message" in envConfig) {
env.message = envConfig.message;
}
});
return "onServiceStart recevied. " + args.join(', ') + ", env: " + JSON.stringify(env);
}
function onServiceStop() {

View File

@ -543,6 +543,7 @@ global.splitLn = splitLn;
global.addslashes = addslashes;
global.AsyncFunction = AsyncFunction;
global.GeneratorFunction = GeneratorFunction;
global.parseEnv = parseEnv;
exports.Event = StdEvent;
exports.EventTarget = StdEventTarget;
@ -551,7 +552,7 @@ exports.Storage = StdStorage;
exports.alert = alert;
exports.confirm = confirm;
exports.VERSIONINFO = "WelsonJS Standard Library (std.js) version 0.8.11";
exports.VERSIONINFO = "WelsonJS Standard Library (std.js) version 0.8.12";
exports.AUTHOR = "abuse@catswords.net";
exports.global = global;
exports.require = global.require;