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