Enable configuration of the server bind address.

A serverconfig.env (or just environment variables) can be set to
override the default bind address/port for the backend. This is passed
to the front end as a query parameter.
This commit is contained in:
Dan Albert
2022-03-07 17:52:33 -08:00
parent a70ab8cc1d
commit baae65919f
4 changed files with 18 additions and 7 deletions

View File

@@ -19,16 +19,15 @@ class ServerSettings(BaseSettings):
# no client/server workflow yet, security has not been a focus.
server_bind_address: str = "::1"
# If you for some reason change the port, you'll need to also update map.js and
# client/src/api/backend.ts.
# This (and the address) will be passed the the front end as a query parameter.
server_port: int = 1688
# Disable to allow requests to be made to the backend without an API key.
require_api_key: bool = True
# Enable to allow cross-origin requests from http://localhost:3000.
cors_allow_debug_server: bool = False
class Config:
env_file = "serverconfig.env"
@classmethod
@lru_cache
def get(cls) -> ServerSettings: