diff --git a/defaultService.example.js b/defaultService.example.js index 9fe01f1..291d3bb 100644 --- a/defaultService.example.js +++ b/defaultService.example.js @@ -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() { diff --git a/lib/std.js b/lib/std.js index a47ea4c..f986e3e 100644 --- a/lib/std.js +++ b/lib/std.js @@ -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;