2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
4
# Copyright 2010 United States Government as represented by the
5
# Administrator of the National Aeronautics and Space Administration.
8
# Licensed under the Apache License, Version 2.0 (the "License");
9
# you may not use this file except in compliance with the License.
10
# You may obtain a copy of the License at
12
# http://www.apache.org/licenses/LICENSE-2.0
14
# Unless required by applicable law or agreed to in writing, software
15
# distributed under the License is distributed on an "AS IS" BASIS,
16
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
# See the License for the specific language governing permissions and
18
# limitations under the License.
20
Reference implementation server for Glance Registry
26
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
28
sys.path.append(ROOT_DIR)
30
from glance.common import flags
31
from glance.common import utils
32
from glance.common import server
36
flags.DEFINE_string('registry_host', '0.0.0.0',
37
'Registry server lives at this address')
38
flags.DEFINE_integer('registry_port', 9191,
39
'Registry server listens on this port')
43
# NOTE(sirp): importing in main so that eventlet is imported AFTER
44
# daemonization. See https://bugs.launchpad.net/bugs/687661
45
from glance.common import wsgi
46
from glance.registry.server import API
47
server = wsgi.Server()
48
server.start(API(), FLAGS.registry_port, host=FLAGS.registry_host)
52
if __name__ == '__main__':
53
utils.default_flagfile()
54
server.serve('glance-registry', main)