diff --git a/.gitignore b/.gitignore index cf0b17b30..6c34610ce 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ ChangeLog .testrepository .coverage cover +etc/vitrage/vitrage.conf #Python *.pyc diff --git a/etc/vitrage/README-vitrage.conf.txt b/etc/vitrage/README-vitrage.conf.txt new file mode 100644 index 000000000..0fc070d6c --- /dev/null +++ b/etc/vitrage/README-vitrage.conf.txt @@ -0,0 +1,4 @@ +To generate the sample vitrage.conf file, run the following +command from the top-level vitrage directory: + +tox -egenconfig \ No newline at end of file diff --git a/etc/vitrage/api-paste.ini b/etc/vitrage/api-paste.ini new file mode 100644 index 000000000..3c87600e7 --- /dev/null +++ b/etc/vitrage/api-paste.ini @@ -0,0 +1,14 @@ +# Remove keystone_authtoken from the pipeline if you don't want to use keystone authentication +[pipeline:main] +pipeline = keystone_authtoken vitrage + +[app:vitrage] +paste.app_factory = vitrage.api.app:app_factory + +[filter:keystone_authtoken] +paste.filter_factory = keystonemiddleware.auth_token:filter_factory +oslo_config_project = vitrage + +[filter:cors] +paste.filter_factory = oslo_middleware.cors:filter_factory +oslo_config_project = vitrage \ No newline at end of file diff --git a/etc/vitrage/vitrage-config-generator.conf b/etc/vitrage/vitrage-config-generator.conf new file mode 100644 index 000000000..bfa99ab4a --- /dev/null +++ b/etc/vitrage/vitrage-config-generator.conf @@ -0,0 +1,9 @@ +[DEFAULT] +output_file = etc/vitrage/vitrage.conf +wrap_width = 79 +namespace = vitrage +namespace = oslo.db +namespace = oslo.log +namespace = oslo.middleware +namespace = oslo.policy +namespace = keystonemiddleware.auth_token \ No newline at end of file diff --git a/tox.ini b/tox.ini index 5192be5b3..9d867105e 100644 --- a/tox.ini +++ b/tox.ini @@ -9,11 +9,16 @@ install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = + python setup.py testr --slowest --testr-args='{posargs}' + oslo-config-generator --config-file=etc/vitrage/vitrage-config-generator.conf [testenv:pep8] commands = flake8 +[testenv:genconfig] +commands = oslo-config-generator --config-file=etc/vitrage/vitrage-config-generator.conf + [testenv:venv] commands = {posargs} diff --git a/vitrage/opts.py b/vitrage/opts.py index d994b6382..d4d8503ec 100644 --- a/vitrage/opts.py +++ b/vitrage/opts.py @@ -15,6 +15,17 @@ from oslo_config import cfg def list_opts(): return [("api", ( + cfg.PortOpt('port', + default=8999, + help='The port for the vitrage API server.', + ), + cfg.StrOpt('host', + default='0.0.0.0', + help='The listen IP for the vitrage API server.', + ), + cfg.StrOpt('paste_config', default="api-paste.ini", + help="Configuration file for WSGI definition of API."), + cfg.IntOpt('workers', default=1, min=1, help='Number of workers for vitrage API server.'),