Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions anms-core/anms/asgi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,7 @@
def main() -> None:
config = ConfigBuilder.get_config()

# SSL Settings
should_start_with_ssl = (
config['SERVER_SSL'] is True
and config['SERVER_BEHIND_PROXY'] is False
and isinstance(config['SERVER_SSL_CRT'], str)
and isinstance(config['SERVER_SSL_KEY'], str)
)
# Preferred method is to use NGINX/reverse proxy with SSL Termination
if should_start_with_ssl:
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) # disable SSLv3
ssl_context.options |= ssl.OP_NO_TLSv1 # disable TLSv1
ssl_context.options |= ssl.OP_NO_TLSv1_1 # disable TLSv1.1
ssl_crt_path = config['SERVER_SSL_CRT']
ssl_key_path = config['SERVER_SSL_KEY']
ssl_key_pass = config['SERVER_SSL_PWD']
# https://github.com/encode/uvicorn/issues/806
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
log_config=None, log_level=config['LOGGER_LEVEL'], access_log=False, # We use our own logger
reload=config['DEBUG'],
ssl_certfile=ssl_crt_path, ssl_keyfile=ssl_key_path, ssl_keyfile_password=ssl_key_pass,
ssl_version=ssl_context.protocol, ssl_ciphers=":".join(map(lambda c: c["name"], ssl_context.get_ciphers())) # type: ignore
)
else:
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
log_config=None, log_level=config['LOGGER_LEVEL'], access_log=False, # We use our own logger
reload=config['DEBUG'])

Expand Down
14 changes: 0 additions & 14 deletions anms-core/anms/run_gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ def load_config(self):
self.cfg.set("proc_name", "anms")
self.cfg.set("preload_app", False)

# SSL Settings
should_start_with_ssl = (
config['SERVER_SSL'] is True
and config['SERVER_BEHIND_PROXY'] is False
and isinstance(config['SERVER_SSL_CRT'], str)
and isinstance(config['SERVER_SSL_KEY'], str)
)
if should_start_with_ssl:
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ssl_context.options |= ssl.OP_NO_TLSv1
ssl_context.options |= ssl.OP_NO_TLSv1_1
self.cfg.set("ssl_version", ssl_context.protocol)
self.cfg.set("certfile", config['SERVER_SSL_CRT'])
self.cfg.set("keyfile", config['SERVER_SSL_KEY'])

# App Secret Manager Help?
if not config['APP_SECRET_KEY']:
Expand Down
23 changes: 0 additions & 23 deletions anms-core/test/__init__.py

This file was deleted.

23 changes: 0 additions & 23 deletions anms-core/test/anms/__init__.py

This file was deleted.

23 changes: 0 additions & 23 deletions anms-core/test/anms/asgi/__init__.py

This file was deleted.

55 changes: 0 additions & 55 deletions anms-core/test/anms/asgi/test_helpers.py

This file was deleted.

66 changes: 0 additions & 66 deletions anms-core/test/anms/asgi/test_init.py

This file was deleted.

54 changes: 0 additions & 54 deletions anms-core/test/anms/asgi/test_server.py

This file was deleted.

23 changes: 0 additions & 23 deletions anms-core/test/anms/components/__init__.py

This file was deleted.

23 changes: 0 additions & 23 deletions anms-core/test/anms/components/core/__init__.py

This file was deleted.

Loading
Loading