hassio-addons/addon-node-red



The issue has been closed
Unable to apply init_commands to set env var #281
regystro posted onGitHub
Problem/Motivation
I'm tryng to fix the lack of internationalization support as they state here https://github.com/nodejs/node/issues/8500#issuecomment-246432058 = only en-US locale is included in nodejs to minimize file size.
Installing full-icu npm module fixes the problem, but it needs environment variable NODE_ICU_DATA. I'm trying to set it through init_commands, but it doesn't seem to work.
Expected behavior
Environment variable NODE_ICU_DATA should be created.
Actual behavior
I'm entering the container's shell once started, but the environment var is not set.
Steps to reproduce
Add tou your add-on config:
"npm_packages": [
"full-icu"
],
"init_commands": [
"NODE_ICU_DATA=/opt/node_modules/full-icu"
]
Then create a simple test function node:
var event = new Date("Thu Aug 01 13:49:33 +0000 2019");
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
msg.payload = event.toLocaleString('de-DE', options);
return msg;
The output should be "Donnerstag, 1. August 2019", but instead it throws "Thursday, August 1, 2019"
Thank you