Merged in bugfix/HTTPASTE-43/config (pull request #39)
Bugfix/HTTPASTE-43/config
This commit is contained in:
commit
ef40069427
5 changed files with 15 additions and 11 deletions
|
|
@ -194,7 +194,7 @@ def load_config(path: str = None, var_name: str = CONFIGPATH_ENVIRON):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
|
||||||
configIni, _ = get_configparser(path, var_name)
|
configIni, path = get_configparser(path, var_name)
|
||||||
|
|
||||||
return get_config(configIni, Path(path).resolve().parent)
|
return get_config(configIni, Path(path).resolve().parent)
|
||||||
|
|
||||||
|
|
@ -203,6 +203,8 @@ def get_flask_app(config: Config) -> FlaskApp:
|
||||||
"""get a flask app object
|
"""get a flask app object
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print(config.server.swagger_ui)
|
||||||
|
|
||||||
options = {"swagger_ui": config.server.swagger_ui}
|
options = {"swagger_ui": config.server.swagger_ui}
|
||||||
|
|
||||||
#context manager returns a pathlib.Path object
|
#context manager returns a pathlib.Path object
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
"""httpaste CGI entrypoint
|
"""httpaste CGI entrypoint
|
||||||
"""
|
"""
|
||||||
from wsgiref.handlers import CGIHandler
|
from wsgiref.handlers import CGIHandler
|
||||||
from httpaste import load_config, get_flask_app, get_config_path
|
from httpaste import load_config, get_flask_app
|
||||||
|
|
||||||
config, server_config = load_config(get_config_path())
|
config = load_config()
|
||||||
|
|
||||||
application = get_flask_app(config, server_config)
|
application = get_flask_app(config)
|
||||||
|
|
||||||
CGIHandler().run(application)
|
CGIHandler().run(application)
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
"""httpaste FastCGI entrypoint
|
"""httpaste FastCGI entrypoint
|
||||||
"""
|
"""
|
||||||
from flup.server.fcgi import WSGIServer
|
from flup.server.fcgi import WSGIServer
|
||||||
from httpaste import load_config, get_flask_app, get_config_path
|
from httpaste import load_config, get_flask_app
|
||||||
|
|
||||||
config, server_config = load_config(get_config_path())
|
config = load_config()
|
||||||
|
|
||||||
application = get_flask_app(config, server_config)
|
application = get_flask_app(config)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ from pathlib import Path
|
||||||
from configparser import ConfigParser, NoSectionError
|
from configparser import ConfigParser, NoSectionError
|
||||||
from typing import Optional, NamedTuple
|
from typing import Optional, NamedTuple
|
||||||
from os import environ
|
from os import environ
|
||||||
|
from ast import literal_eval
|
||||||
|
|
||||||
|
|
||||||
CONFIGPATH_ENVIRON = 'HTTPASTE_CONFIGPATH'
|
CONFIGPATH_ENVIRON = 'HTTPASTE_CONFIGPATH'
|
||||||
|
|
@ -49,8 +50,9 @@ def typecast(obj: dict, aclass: type, dirname:Optional[Path] = None) -> dict:
|
||||||
|
|
||||||
casted[k] = casted_val = dirname / v
|
casted[k] = casted_val = dirname / v
|
||||||
elif issubclass(bclass, bytes):
|
elif issubclass(bclass, bytes):
|
||||||
|
|
||||||
casted[k] = bclass(v.encode('utf-8'))
|
casted[k] = bclass(v.encode('utf-8'))
|
||||||
|
elif issubclass(bclass, bool):
|
||||||
|
casted[k] = literal_eval(v)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
casted_val = bclass(v)
|
casted_val = bclass(v)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""httpaste WSGI entrypoint
|
"""httpaste WSGI entrypoint
|
||||||
"""
|
"""
|
||||||
from httpaste import load_config, get_flask_app, get_config_path
|
from httpaste import load_config, get_flask_app
|
||||||
|
|
||||||
config, server_config = load_config(get_config_path())
|
config = load_config()
|
||||||
|
|
||||||
application = get_flask_app(config, server_config)
|
application = get_flask_app(config)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue