MCPcopy Create free account
hub / github.com/StackStorm/st2 / _run_server

Function _run_server

st2auth/st2auth/cmd/api.py:70–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68
69
70def _run_server():
71 host = cfg.CONF.auth.host
72 port = cfg.CONF.auth.port
73 use_ssl = cfg.CONF.auth.use_ssl
74
75 cert_file_path = os.path.realpath(cfg.CONF.auth.cert)
76 key_file_path = os.path.realpath(cfg.CONF.auth.key)
77
78 if use_ssl and not os.path.isfile(cert_file_path):
79 raise ValueError('Certificate file "%s" doesn\'t exist' % (cert_file_path))
80
81 if use_ssl and not os.path.isfile(key_file_path):
82 raise ValueError('Private key file "%s" doesn\'t exist' % (key_file_path))
83
84 socket = eventlet.listen((host, port))
85
86 if use_ssl:
87 socket = eventlet.wrap_ssl(
88 socket, certfile=cert_file_path, keyfile=key_file_path, server_side=True
89 )
90
91 LOG.info('ST2 Auth API running in "%s" auth mode', cfg.CONF.auth.mode)
92 LOG.info(
93 "(PID=%s) ST2 Auth API is serving on %s://%s:%s.",
94 os.getpid(),
95 "https" if use_ssl else "http",
96 host,
97 port,
98 )
99
100 wsgi.server(socket, app.setup_app(), log=LOG, log_output=False)
101 return 0
102
103
104def _teardown():

Callers 1

mainFunction · 0.70

Calls 1

listenMethod · 0.80

Tested by

no test coverage detected