Fix config file path treatment when using uwsgi

This commit fixes the treatment of the config file path when we use the
Flask app directly. Originally, when we use the Flask app such as using
with uwsgi which is mentioned in the README as one of production
settings, the parameter '--pyargv config_file' doesn't work because we
read '/etc/openstack-health.conf' file directly. It should work,
otherwise, users can't specify the config file.

Change-Id: I1beb927200880d42e40e49db3aab47453f83169f
This commit is contained in:
Masayuki Igawa 2017-10-31 19:57:25 +09:00
parent 14bfbbfc09
commit 91b87a9578
No known key found for this signature in database
GPG Key ID: 290F53EDC899BF89
1 changed files with 4 additions and 2 deletions

View File

@ -86,8 +86,9 @@ def _setup():
def setup():
global config
if not config:
args = parse_command_line_args()
config = ConfigParser.ConfigParser()
config.read('/etc/openstack-health.conf')
config.read(args.config_file)
# Database Configuration
global engine
db_uri = _config_get(config.get, 'default', 'db_uri')
@ -675,7 +676,8 @@ def parse_command_line_args():
description = 'Starts the API service for openstack-health'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('config_file', type=str,
parser.add_argument('config_file', type=str, nargs='?',
default='/etc/openstack-health.conf',
help='the path for the config file to be read.')
return parser.parse_args()