From 5fb2bd641198bb6b0a1c98f7bc875737a49c814e Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Mon, 23 Sep 2019 09:09:58 +0100 Subject: [PATCH 1/3] #68: Update example config --- config.json.example | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config.json.example b/config.json.example index 70c182f6..6ff8e463 100644 --- a/config.json.example +++ b/config.json.example @@ -2,7 +2,9 @@ "DB_URL": "mysql+pymysql://root:rootpw@localhost:13306/icatdb", "log_level": "WARN", "debug_mode": false, - "generate_swagger": false + "generate_swagger": false, + "host": "127.0.0.1", + "port": "5000" } From 3a34c3be7bf528c86aadb611e1b33f8a65f7ee6e Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Mon, 23 Sep 2019 09:10:26 +0100 Subject: [PATCH 2/3] #68: Update config.py --- common/config.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/config.py b/common/config.py index e68d87b3..69d27490 100644 --- a/common/config.py +++ b/common/config.py @@ -33,4 +33,17 @@ def is_generate_swagger(self): except: sys.exit("Missing config value, generate_swagger") + def get_host(self): + try: + return self.config["host"] + except: + sys.exit("Missing config value, host") + + def get_port(self): + try: + return self.config["port"] + except: + sys.exit("Missing config value, port") + + config = Config() From 6cbb1ae71b9f0ef482cdd8f113fd0d9499831746 Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Mon, 23 Sep 2019 09:10:48 +0100 Subject: [PATCH 3/3] #68: Specify port and host in main.py --- src/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.py b/src/main.py index d8b8b694..889ef4b6 100644 --- a/src/main.py +++ b/src/main.py @@ -215,4 +215,6 @@ "/instruments//facilitycycles//investigations/count") if __name__ == "__main__": + app.run(host=config.get_host(), port=config.get_port()) app.run(debug=config.is_debug_mode()) +