Add default rest config

This commit is contained in:
Matthias 2019-05-18 10:24:01 +02:00
parent fd5012c04e
commit c272e1ccdf
2 changed files with 17 additions and 9 deletions

View File

@ -109,6 +109,11 @@
"token": "your_telegram_token",
"chat_id": "your_telegram_chat_id"
},
"api_server": {
"enabled": false,
"listen_ip_address": "127.0.0.1",
"listen_port": 8080
},
"db_url": "sqlite:///tradesv3.sqlite",
"initial_state": "running",
"forcebuy_enable": false,

View File

@ -234,9 +234,7 @@ def load_config(configfile):
return {}
def main(args):
if args.get("show"):
def print_commands():
# Print dynamic help for the different commands
client = FtRestClient(None)
print("Possible commands:")
@ -244,7 +242,11 @@ def main(args):
if not x.startswith('_'):
print(f"{x} {getattr(client, x).__doc__}")
return
def main(args):
if args.get("help"):
print_commands()
config = load_config(args["config"])
url = config.get("api_server", {}).get("server_url", "127.0.0.1")
@ -256,6 +258,7 @@ def main(args):
command = args["command"]
if command not in m:
logger.error(f"Command {command} not defined")
print_commands()
return
print(getattr(client, command)(*args["command_arguments"]))