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:
parent
14bfbbfc09
commit
91b87a9578
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue