|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
3 | | -import logging |
4 | 3 | import os |
5 | 4 | import sys |
6 | 5 |
|
| 6 | +from oidcrp.configure import Configuration |
| 7 | +from oidcrp.configure import RPConfiguration |
| 8 | +from oidcrp.configure import create_from_config_file |
7 | 9 | from oidcrp.util import create_context |
8 | 10 |
|
9 | 11 | try: |
10 | 12 | from . import application |
11 | 13 | except ImportError: |
12 | 14 | import application |
13 | 15 |
|
14 | | -# logger = logging.getLogger("") |
15 | | -# RP_LOGFILE_NAME = os.environ.get('RP_LOGFILE_NAME', 'flrp.log') |
16 | | -# |
17 | | -# hdlr = logging.FileHandler(RP_LOGFILE_NAME) |
18 | | -# log_format = ("%(asctime)s %(name)s:%(levelname)s " |
19 | | -# "%(message)s [%(name)s.%(funcName)s:%(lineno)s]") |
20 | | -# base_formatter = logging.Formatter(log_format) |
21 | | -# |
22 | | -# hdlr.setFormatter(base_formatter) |
23 | | -# logger.addHandler(hdlr) |
24 | | -# logger.setLevel(logging.DEBUG) |
25 | | -# |
26 | | -# stdout = logging.StreamHandler() |
27 | | -# stdout.setFormatter(base_formatter) |
28 | | -# logger.addHandler(stdout) |
29 | | - |
30 | 16 | dir_path = os.path.dirname(os.path.realpath(__file__)) |
31 | 17 |
|
32 | 18 | if __name__ == "__main__": |
33 | 19 | conf = sys.argv[1] |
34 | 20 | name = 'oidc_rp' |
35 | 21 | template_dir = os.path.join(dir_path, 'templates') |
36 | | - app = application.oidc_provider_init_app(conf, name, |
37 | | - template_folder=template_dir) |
38 | | - _web_conf = app.rp_config.web_conf |
| 22 | + |
| 23 | + _config = create_from_config_file(Configuration, |
| 24 | + entity_conf_class=RPConfiguration, |
| 25 | + filename=conf) |
| 26 | + |
| 27 | + app = application.oidc_provider_init_app(_config.rp, name, template_folder=template_dir) |
| 28 | + _web_conf = _config.web_conf |
39 | 29 | context = create_context(dir_path, _web_conf) |
40 | 30 |
|
41 | 31 | debug = _web_conf.get('debug', True) |
42 | | - app.run(host=app.rp_config.domain, port=app.rp_config.port, |
| 32 | + app.run(host=_web_conf["domain"], port=_web_conf["port"], |
43 | 33 | debug=_web_conf.get("debug", False), ssl_context=context) |
0 commit comments