Skip to content

Commit

Permalink
Merge pull request #69 from ral-facilities/68_specify_host_and_port_i…
Browse files Browse the repository at this point in the history
…n_config

Specify host and port in config
  • Loading branch information
keiranjprice101 authored Oct 1, 2019
2 parents 0d97b57 + 6cbb1ae commit e69981d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,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()
4 changes: 3 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


Expand Down
2 changes: 2 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,6 @@
"/instruments/<int:instrument_id>/facilitycycles/<int:cycle_id>/investigations/count")

if __name__ == "__main__":
app.run(host=config.get_host(), port=config.get_port())
app.run(debug=config.is_debug_mode())

0 comments on commit e69981d

Please sign in to comment.