-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make config overridable by environment variables #2
Open
alexandre-abrioux
wants to merge
1
commit into
cartesi:master
Choose a base branch
from
alexandre-abrioux:config-env-vars
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# URL of the Ethereum node | ||
URL=http://localhost:8545 | ||
# Default to 24 hours | ||
TIMEOUT=86400000 | ||
RETRY_INTERVAL=10000 | ||
POLLING_INTERVAL=30000 | ||
CONFIRMATIONS=1 | ||
# Default to 10 minutes | ||
CONFIRMATION_TIMEOUT=600000 | ||
GAS_LIMIT_MULTIPLIER=160 | ||
GAS_PRICE_MULTIPLIER=160 | ||
BALANCE_THRESHOLD=0.05 | ||
# Gas price predictor strategy. One of < eth-provider | fast | fastest | safeLow | average > | ||
GAS_PRICE_PROVIDER=eth-provider | ||
|
||
# ETH Gas Station API parameters | ||
GAS_STATION_API_CHAIN_ID=1 | ||
GAS_STATION_API_URL=https://ethgasstation.info/json/ethgasAPI.json | ||
GAS_STATION_API_KEY= | ||
GAS_STATION_API_REQUEST_TIMEOUT_MS=10000 | ||
|
||
# When loading wallet from MNEMONIC | ||
MNEMONIC= | ||
MNEMONIC_PATH= | ||
|
||
# When loading wallet from SEED | ||
SEED= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem as MNEMONIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"extension": ["ts"], | ||
"timeout": 10000, | ||
"require": "ts-node/register", | ||
"require": ["ts-node/register", "test/setup.ts"], | ||
"spec": "test/**/*.spec.ts", | ||
"watch-files": ["test/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2020 Cartesi Pte. Ltd. | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software distributed | ||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
|
||
import { config } from "dotenv"; | ||
config(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2020 Cartesi Pte. Ltd. | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software distributed | ||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
|
||
import "../src/env"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a good idea to have the option to set the MNEMONIC here, some users might set this and it's definitely very unsafe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is very unsafe indeed but the only way as far as I know to start the node without a TTY, in a CI pipeline for instance. We could provide an option to use Docker Swarm Secrets or Kubernetes File Secrets with an environment variables like
MNEMONIC_FILE
targeting the path of a mounted file in the container, but it probably is worth opening a whole new issue for this. TheMNEMONIC
env var is an undocumented feature but it could be nice to reference the variable here for advanced users who are able to add other layers of security to prevent leaks until a better solution is offered. We could even write a warning in the comment like so:What do you think?