mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 18:23:55 +00:00
Merge pull request #1951 from hroff-1902/pipe-config
allow reading config from stdin
This commit is contained in:
commit
b8fb38b92c
|
@ -26,7 +26,8 @@ optional arguments:
|
|||
--version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: None). Multiple
|
||||
--config options may be used.
|
||||
--config options may be used. Can be set to '-' to
|
||||
read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to backtest data.
|
||||
-s NAME, --strategy NAME
|
||||
|
|
|
@ -85,8 +85,9 @@ class Arguments(object):
|
|||
)
|
||||
self.parser.add_argument(
|
||||
'-c', '--config',
|
||||
help='Specify configuration file (default: %(default)s). '
|
||||
'Multiple --config options may be used.',
|
||||
help="Specify configuration file (default: %(default)s). "
|
||||
"Multiple --config options may be used. "
|
||||
"Can be set to '-' to read config from stdin.",
|
||||
dest='config',
|
||||
action='append',
|
||||
type=str,
|
||||
|
|
|
@ -79,6 +79,7 @@ class Configuration(object):
|
|||
# Now expecting a list of config filenames here, not a string
|
||||
for path in self.args.config:
|
||||
logger.info('Using config: %s ...', path)
|
||||
|
||||
# Merge config options, overwriting old values
|
||||
config = deep_merge_dicts(self._load_config_file(path), config)
|
||||
|
||||
|
@ -118,7 +119,8 @@ class Configuration(object):
|
|||
:return: configuration as dictionary
|
||||
"""
|
||||
try:
|
||||
with open(path) as file:
|
||||
# Read config from stdin if requested in the options
|
||||
with open(path) if path != '-' else sys.stdin as file:
|
||||
conf = json.load(file)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(
|
||||
|
|
Loading…
Reference in New Issue
Block a user