Fix mixup of swarm and kubernetes when reading env variables + refactoring
This commit is contained in:
parent
0356250d9d
commit
e37e6c3460
|
@ -31,9 +31,9 @@ try:
|
|||
# Get env vars
|
||||
bw_integration = None
|
||||
if getenv("KUBERNETES_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("AUTOCONF_MODE") == "yes":
|
||||
bw_integration = "Autoconf"
|
||||
elif Path("/usr/share/bunkerweb/INTEGRATION").exists():
|
||||
|
|
|
@ -32,9 +32,9 @@ try:
|
|||
# Get env vars
|
||||
bw_integration = None
|
||||
if getenv("KUBERNETES_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("AUTOCONF_MODE") == "yes":
|
||||
bw_integration = "Autoconf"
|
||||
elif Path("/usr/share/bunkerweb/INTEGRATION").exists():
|
||||
|
|
|
@ -36,9 +36,9 @@ try:
|
|||
# Get env vars
|
||||
bw_integration = None
|
||||
if getenv("KUBERNETES_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
elif getenv("SWARM_MODE") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("AUTOCONF_MODE") == "yes":
|
||||
bw_integration = "Autoconf"
|
||||
elif Path("/usr/share/bunkerweb/INTEGRATION").exists():
|
||||
|
|
|
@ -48,7 +48,7 @@ function log() {
|
|||
category="$1"
|
||||
severity="$2"
|
||||
message="$3"
|
||||
echo "$when $category - $severity - $message"
|
||||
echo "$when - $category - $severity - $message"
|
||||
}
|
||||
|
||||
# get only interesting env (var=value)
|
||||
|
|
|
@ -3,6 +3,7 @@ from os import environ, getenv
|
|||
from os.path import sep
|
||||
from sys import path as sys_path
|
||||
from tarfile import open as taropen
|
||||
from typing import Optional
|
||||
|
||||
if "/usr/share/bunkerweb/utils" not in sys_path:
|
||||
sys_path.append("/usr/share/bunkerweb/utils")
|
||||
|
@ -22,7 +23,7 @@ class ApiCaller:
|
|||
self.__apis = apis
|
||||
self.__logger = setup_logger("Api", environ.get("LOG_LEVEL", "INFO"))
|
||||
|
||||
def auto_setup(self, bw_integration: str = None):
|
||||
def auto_setup(self, bw_integration: Optional[str] = None):
|
||||
if bw_integration is None:
|
||||
if getenv("KUBERNETES_MODE", "no") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
|
|
Loading…
Reference in New Issue