1*2c6fc760SBrad Bishop#!/usr/bin/env python
2*2c6fc760SBrad Bishop
3*2c6fc760SBrad Bishop# Contributors Listed Below - COPYRIGHT 2016
4*2c6fc760SBrad Bishop# [+] International Business Machines Corp.
5*2c6fc760SBrad Bishop#
6*2c6fc760SBrad Bishop#
7*2c6fc760SBrad Bishop# Licensed under the Apache License, Version 2.0 (the "License");
8*2c6fc760SBrad Bishop# you may not use this file except in compliance with the License.
9*2c6fc760SBrad Bishop# You may obtain a copy of the License at
10*2c6fc760SBrad Bishop#
11*2c6fc760SBrad Bishop#     http://www.apache.org/licenses/LICENSE-2.0
12*2c6fc760SBrad Bishop#
13*2c6fc760SBrad Bishop# Unless required by applicable law or agreed to in writing, software
14*2c6fc760SBrad Bishop# distributed under the License is distributed on an "AS IS" BASIS,
15*2c6fc760SBrad Bishop# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16*2c6fc760SBrad Bishop# implied. See the License for the specific language governing
17*2c6fc760SBrad Bishop# permissions and limitations under the License.
18*2c6fc760SBrad Bishop
19*2c6fc760SBrad Bishopimport sys
20*2c6fc760SBrad Bishopimport os
21*2c6fc760SBrad Bishopimport logging
22*2c6fc760SBrad Bishopfrom rocket import Rocket
23*2c6fc760SBrad Bishop
24*2c6fc760SBrad Bishopif __name__ == '__main__':
25*2c6fc760SBrad Bishop    if len(sys.argv) < 2:
26*2c6fc760SBrad Bishop        sys.stderr.write('WSGI application required!')
27*2c6fc760SBrad Bishop        sys.exit(1)
28*2c6fc760SBrad Bishop
29*2c6fc760SBrad Bishop    exec 'from obmc.wsgi.apps.%s import App' % sys.argv[1]
30*2c6fc760SBrad Bishop
31*2c6fc760SBrad Bishop    log = logging.getLogger('Rocket.Errors')
32*2c6fc760SBrad Bishop    log.setLevel(logging.INFO)
33*2c6fc760SBrad Bishop    log.addHandler(logging.StreamHandler(sys.stdout))
34*2c6fc760SBrad Bishop
35*2c6fc760SBrad Bishop    default_cert = os.path.join(
36*2c6fc760SBrad Bishop        sys.prefix, 'share', os.path.basename(__file__), 'cert.pem')
37*2c6fc760SBrad Bishop
38*2c6fc760SBrad Bishop    app = App()
39*2c6fc760SBrad Bishop    server = Rocket(
40*2c6fc760SBrad Bishop        ('0.0.0.0', 443, default_cert, default_cert),
41*2c6fc760SBrad Bishop        'wsgi', {'wsgi_app': app},
42*2c6fc760SBrad Bishop        min_threads=1,
43*2c6fc760SBrad Bishop        max_threads=1)
44*2c6fc760SBrad Bishop    server.start()
45