Add host and port variables to api server

This commit adds 'host' and 'port' configuration variables to the o-h
api server. Sometimes, default port(5000) conflicts existing port
number. And default host address(127.0.0.1) is not good remote
development environment. I think there are some workaround for this such
as portforwarding but this would be a straight forward solution.

Change-Id: I8531860757fb9c7625f7a009175af1b40ca52dc9
Closes-Bug: #1554955
This commit is contained in:
Masayuki Igawa 2016-03-09 16:54:00 +09:00 committed by Tim Buckley
parent 567d9d2a24
commit ce8a2372f3
2 changed files with 11 additions and 1 deletions

View File

@ -9,3 +9,5 @@ ignored_run_metadata_keys =
build_short_uuid
build_uuid
build_zuul_url
host = 127.0.0.1
port = 5000

View File

@ -394,7 +394,15 @@ def main():
args = parse_command_line_args()
config = ConfigParser.ConfigParser()
config.read(args.config_file)
app.run(debug=True)
try:
host = config.get('default', 'host')
except ConfigParser.NoOptionError:
host = '127.0.0.1'
try:
port = config.getint('default', 'port')
except ConfigParser.NoOptionError:
port = 5000
app.run(debug=True, host=host, port=port)
if __name__ == '__main__':