mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Implemented new matomo setup
This commit is contained in:
@@ -112,7 +112,7 @@ class FilterModule(object):
|
||||
self.is_feature_enabled(applications, matomo_feature_name, application_id)
|
||||
and directive in ['script-src-elem', 'connect-src']
|
||||
):
|
||||
matomo_domain = domains.get('matomo')[0]
|
||||
matomo_domain = domains.get('web-app-matomo')[0]
|
||||
if matomo_domain:
|
||||
tokens.append(f"{web_protocol}://{matomo_domain}")
|
||||
|
||||
|
25
filter_plugins/docker_service_enabled.py
Normal file
25
filter_plugins/docker_service_enabled.py
Normal file
@@ -0,0 +1,25 @@
|
||||
class FilterModule(object):
|
||||
''' Custom filter to safely check if a docker service is enabled for an application_id '''
|
||||
|
||||
def filters(self):
|
||||
return {
|
||||
'is_docker_service_enabled': self.is_docker_service_enabled
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def is_docker_service_enabled(applications, application_id, service_name):
|
||||
"""
|
||||
Returns True if applications[application_id].docker.services[service_name].enabled is truthy,
|
||||
otherwise returns False (even if intermediate keys are missing).
|
||||
"""
|
||||
try:
|
||||
return bool(
|
||||
applications
|
||||
and application_id in applications
|
||||
and applications[application_id].get('docker', {})
|
||||
.get('services', {})
|
||||
.get(service_name, {})
|
||||
.get('enabled', False)
|
||||
)
|
||||
except Exception:
|
||||
return False
|
Reference in New Issue
Block a user