However if this is entered literally ie via the CLI, the typical shell processor will actually set something different due to quote handling.
ie
$ EGERIA_PRESENTATIONSERVER_SERVER_aaa={"remoteServerName":"cocoView1","remoteURL":"https://localhost:9443"}
$ echo $EGERIA_PRESENTATIONSERVER_SERVER_aaa
{remoteServerName:cocoView1,remoteURL:https://localhost:9443}
If this is used, then 'npm start' is issues we see:
Found server name aaa
SyntaxError: Unexpected token r in JSON at position 1
at JSON.parse ()
at getServerInfoFromEnv (/Users/jonesn/IdeaProjects/egeria-react-ui/cra-server/functions/getServerInfoFromEnv.js:27:38)
at Object. (/Users/jonesn/IdeaProjects/egeria-react-ui/cra-server/index.js:34:17)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
Error occured processing environment variables. Ignore and carry on looking for more valid server content.
Server listening on port: 8091
React UI listening on port: 3000
This is because the JSON could not be parsed.
It's also worth noting that the server has started up regardless - and since the env var cannot be configured this is a fatal error.
I feel that if no valid configuration can be parsed, the startup should fail.
Obviously the server specified could be invalid and discovered later - but in this case it is obviously wrong (null)
On the configuration - this works:
Using a typical shell approach with characters that have significant shell meaning is a little problematic. A non-JSON format may be advisable, or a file based configuration.
The current README states:
However if this is entered literally ie via the CLI, the typical shell processor will actually set something different due to quote handling.
ie
Found server name aaa SyntaxError: Unexpected token r in JSON at position 1 at JSON.parse ()
at getServerInfoFromEnv (/Users/jonesn/IdeaProjects/egeria-react-ui/cra-server/functions/getServerInfoFromEnv.js:27:38)
at Object. (/Users/jonesn/IdeaProjects/egeria-react-ui/cra-server/index.js:34:17)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
Error occured processing environment variables. Ignore and carry on looking for more valid server content.
Server listening on port: 8091
React UI listening on port: 3000
$ EGERIA_PRESENTATIONSERVER_SERVER_aaa="{\"remoteServerName\":\"cocoView1\",\"remoteURL\":\"https://localhost:9443\"}"
(base) jonesn:cra-server/ (issue79) $ echo $EGERIA_PRESENTATIONSERVER_SERVER_aaa [11:32:57] {"remoteServerName":"cocoView1","remoteURL":"https://localhost:9443"}