api: trim whitespace off env vars

This commit is contained in:
Thomas Hobson 2021-02-21 12:57:20 +13:00
parent cdc65d6605
commit 233fb9bf26
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 2 additions and 1 deletions

View File

@ -59,10 +59,11 @@ class Runtime {
const env_content = fss.read_file_sync(env_file).toString();
this.#env_vars = {};
env_content
.trim()
.split('\n')
.map(line => line.split('=',2))
.forEach(([key,val]) => {
this.#env_vars[key] = val;
this.#env_vars[key.trim()] = val.trim();
});
}
return this.#env_vars;