Properly pass environment variables to the process
This commit is contained in:
parent
a598bbab4b
commit
2ad61e6afa
|
@ -0,0 +1,3 @@
|
||||||
|
THRESHOLD_LISTENER_PORT=13867
|
||||||
|
THRESHOLD_RELAY_PORT=13868
|
||||||
|
THRESHOLD_API_PORT=13869
|
|
@ -7,9 +7,11 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
ports:
|
ports:
|
||||||
- "13867:13867"
|
- "${THRESHOLD_LISTENER_PORT}:${THRESHOLD_LISTENER_PORT}"
|
||||||
- "13868:13868"
|
- "${THRESHOLD_RELAY_PORT}:${THRESHOLD_RELAY_PORT}"
|
||||||
- "13869:13869"
|
- "${THRESHOLD_API_PORT}:${THRESHOLD_API_PORT}"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
# for development
|
# for development
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
24
threshold
24
threshold
|
@ -39,21 +39,25 @@ stdout = getwriter("utf8")(stdout) # this is a generic fix but we all know
|
||||||
stderr = getwriter("utf8")(stderr) # it's just for the retards on Rizon using
|
stderr = getwriter("utf8")(stderr) # it's just for the retards on Rizon using
|
||||||
# unicode quit messages for no reason
|
# unicode quit messages for no reason
|
||||||
|
|
||||||
|
trues = ('true', '1', 't', True)
|
||||||
|
|
||||||
# Main listener
|
# Main listener
|
||||||
listener_address = getenv("THRESHOLD_LISTENER_HOST") or main.config["Listener"]["Address"]
|
listener_address = getenv("THRESHOLD_LISTENER_HOST", main.config["Listener"]["Address"])
|
||||||
listener_port = int(getenv("THRESHOLD_LISTENER_PORT")) or main.config["Listener"]["Port"]
|
listener_port = int(getenv("THRESHOLD_LISTENER_PORT", main.config["Listener"]["Port"]))
|
||||||
listener_ssl = int(getenv("THRESHOLD_LISTENER_SSL")) or main.config["Listener"]["UseSSL"]
|
listener_ssl = getenv("THRESHOLD_LISTENER_SSL", main.config["Listener"]["UseSSL"]) in trues
|
||||||
|
|
||||||
# RelayAPI
|
# RelayAPI
|
||||||
relay_enabled = int(getenv("THRESHOLD_RELAY_ENABLED")) or main.config["Relay"]["Enabled"]
|
relay_enabled = getenv("THRESHOLD_RELAY_ENABLED", main.config["RelayAPI"]["Enabled"]) in trues
|
||||||
relay_address = getenv("THRESHOLD_RELAY_HOST") or main.config["RelayAPI"]["Address"]
|
relay_address = getenv("THRESHOLD_RELAY_HOST", main.config["RelayAPI"]["Address"])
|
||||||
relay_port = int(getenv("THRESHOLD_RELAY_PORT")) or main.config["RelayAPI"]["Port"]
|
relay_port = int(getenv("THRESHOLD_RELAY_PORT", main.config["RelayAPI"]["Port"]))
|
||||||
relay_ssl = int(getenv("THRESHOLD_RELAY_SSL")) or main.config["RelayAPI"]["UseSSL"]
|
relay_ssl = getenv("THRESHOLD_RELAY_SSL", main.config["RelayAPI"]["UseSSL"]) in trues
|
||||||
|
|
||||||
# Web API
|
# Web API
|
||||||
api_enabled = int(getenv("THRESHOLD_API_ENABLED")) or main.config["API"]["Enabled"]
|
api_enabled = getenv("THRESHOLD_API_ENABLED", main.config["API"]["Enabled"]) in trues
|
||||||
api_address = getenv("THRESHOLD_API_HOST") or main.config["API"]["Address"]
|
api_address = getenv("THRESHOLD_API_HOST", main.config["API"]["Address"])
|
||||||
api_port = int(getenv("THRESHOLD_API_PORT")) or main.config["API"]["Port"]
|
api_port = int(getenv("THRESHOLD_API_PORT", main.config["API"]["Port"]))
|
||||||
|
print("API PORT", api_port)
|
||||||
|
print("ENV PORT", getenv("THRESHOLD_API_PORT"))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
listener = ServerFactory()
|
listener = ServerFactory()
|
||||||
|
|
Loading…
Reference in New Issue