Skip to content

Add config validation#149

Merged
emostov merged 5 commits intoparitytech:masterfrom
chevdor:wk-badconfig-exit
Jul 4, 2020
Merged

Add config validation#149
emostov merged 5 commits intoparitytech:masterfrom
chevdor:wk-badconfig-exit

Conversation

@chevdor
Copy link
Contributor

@chevdor chevdor commented Jul 4, 2020

It is important to abort if the config is not valid.
This PR shows the compact version of the config if the config is ok, as info for the user.
However, if the config is NOT ok, it will show the full (= not compact) version to help the user figure out the issue then exit.

Here is a run where I am passing a bad W_URL:

$ NODE_ENV=web3 SAS_SUBSTRATE_WS_URL=BAD y start
yarn run v1.22.4
$ yarn run build && yarn run main
$ tsc
$ node ./build/src/main.js
SAS:
  📦 EXPRESS:
     ✅ LOG_MODE: errors
    Log level
 
     ✅ BIND_HOST: 127.0.0.1
    Network interface we bind to
 
     ✅ PORT: 8080
    Port of the web service
    regexp: ^\d{2,6}$
 
  📦 SUBSTRATE:
     ✅ NAME: Default Substrate Dev Node
    Name for our node endpoint
 
     ❌ WS_URL: BAD
    Websocket URL
    regexp: ^wss?:\/\/.*(:\d{4,5})?$
 
Your config is NOT valid, exiting
error Command failed with exit code 1.

@chevdor
Copy link
Contributor Author

chevdor commented Jul 4, 2020

The failure comes from the fact that confmgr now expect node v12 or above.
It this is an issue for you, I can check if I can do without the requirements. If you can leave with that, just bump up to 12+.

@emostov emostov merged commit b3f6177 into paritytech:master Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants