autoconf - init work on static server configs as env var

This commit is contained in:
florian 2022-06-27 08:50:14 +02:00
parent 4a699ef6c6
commit a18d77aeee
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
3 changed files with 16 additions and 9 deletions

View File

@ -2,6 +2,7 @@
## v1.4.2 -
- Fix wrong env file when running jobs using Linux integration
- Fix bwcli unban command when using Linux integration
- Fix permissions check when filename has a space
- Fix static config (SERVER_NAME not empty) support when using autoconf/swarm/k8s
@ -9,7 +10,7 @@
- Add log_default() plugin hook
- Add various certbot-dns examples
- Force NGINX version dependencies in Linux packages DEB/RPM
- Add Discord to supported plugins
- Add Discord to supported official plugins
## v1.4.1 - 2022/16/06

View File

@ -5,7 +5,7 @@ from docker import DockerClient
from Controller import Controller
from logger import log
class DockerController(Controller) :
class DockerController(Controller, ConfigCaller) :
def __init__(self, docker_host) :
super().__init__("docker")
@ -22,10 +22,9 @@ class DockerController(Controller) :
instance["env"] = {}
for env in controller_instance.attrs["Config"]["Env"] :
variable = env.split("=")[0]
if variable in ["PATH", "NGINX_VERSION", "NJS_VERSION", "PKG_RELEASE"] :
continue
value = env.replace(variable + "=", "", 1)
instance["env"][variable] = value
if self._is_setting(variable) :
instance["env"][variable] = value
return [instance]
def _get_controller_services(self) :
@ -36,7 +35,10 @@ class DockerController(Controller) :
for variable, value in controller_service.labels.items() :
if not variable.startswith("bunkerweb.") :
continue
service[variable.replace("bunkerweb.", "", 1)] = value
real_variable = variable.replace("bunkerweb.", "", 1)
if not self._is_multisite_setting(real_variable) :
continue
service[real_variable] = value
return [service]
def get_configs(self) :

View File

@ -6,7 +6,7 @@ from base64 import b64decode
from Controller import Controller
class SwarmController(Controller) :
class SwarmController(Controller, ConfigCaller) :
def __init__(self, docker_host) :
super().__init__("swarm")
@ -22,7 +22,8 @@ class SwarmController(Controller) :
for env in controller_instance.attrs["Spec"]["TaskTemplate"]["ContainerSpec"]["Env"] :
variable = env.split("=")[0]
value = env.replace(variable + "=", "", 1)
instance_env[variable] = value
if self._is_setting(variable) :
instance["env"][variable] = value
for task in controller_instance.tasks() :
instance = {}
instance["name"] = task["ID"]
@ -40,7 +41,10 @@ class SwarmController(Controller) :
for variable, value in controller_service.attrs["Spec"]["Labels"].items() :
if not variable.startswith("bunkerweb.") :
continue
service[variable.replace("bunkerweb.", "", 1)] = value
real_variable = variable.replace("bunkerweb.", "", 1)
if not self._is_multisite_setting(real_variable) :
continue
service[real_variable] = value
return [service]
def get_configs(self) :