feat: adds envs and rename function to group and rename apps

This commit is contained in:
2025-09-10 11:00:55 +02:00
parent 538232baed
commit 051d904c9d
2 changed files with 48 additions and 3 deletions

View File

@ -69,11 +69,22 @@ COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/"
# BACKGROUND_BOX_COLOR='#eaeaeacf'
# THEME_BACKGROUND="url('https://authentik.example.com/static/dist/assets/images/flow_background.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover;"
# Group Name Variables to cluster Applications
# GROUP_SUPPORT=Support
# GROUP_HELP=Help
# GROUP_ORGANISATION=Organisation
# GROUP_COMMUNICATION=Communication
# GROUP_COLLABORATION=Collaboration
# GROUP_DOCUMENTATION=Documentation
# GROUP_DEVELOPMENT=Development
# GROUP_INFRASTRUCTURE=Infrastructure
# COMPOSE_FILE="$COMPOSE_FILE:compose.nextcloud.yml"
# NEXTCLOUD_DOMAIN=nextcloud.example.com
# SECRET_NEXTCLOUD_ID_VERSION=v1
# SECRET_NEXTCLOUD_SECRET_VERSION=v1
# APP_ICONS="nextcloud:~/.abra/recipes/authentik/icons/nextcloud.png"
# NEXTCLOUD_APPGROUP="$GROUP_ORGANISATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.wordpress.yml"
# WORDPRESS_DOMAIN=wordpress.example.com
@ -81,6 +92,7 @@ COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/"
# SECRET_WORDPRESS_ID_VERSION=v1
# SECRET_WORDPRESS_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS wordpress:~/.abra/recipes/authentik/icons/wordpress.png"
# WORDPRESS_APPGROUP="$GROUP_DEVELOPMENT"
# COMPOSE_FILE="$COMPOSE_FILE:compose.matrix.yml"
# ELEMENT_DOMAIN=element-web.example.com
@ -88,52 +100,61 @@ COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/"
# SECRET_MATRIX_ID_VERSION=v1
# SECRET_MATRIX_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS matrix:~/.abra/recipes/authentik/icons/matrix.svg"
# MATRIX_APPGROUP="$GROUP_COMMUNICATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.wekan.yml"
# WEKAN_DOMAIN=wekan.example.com
# SECRET_WEKAN_ID_VERSION=v1
# SECRET_WEKAN_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS wekan:~/.abra/recipes/authentik/icons/wekan.png"
# WEKAN_APPGROUP="$GROUP_ORGANISATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.vikunja.yml"
# VIKUNJA_DOMAIN=vikunja.example.com
# SECRET_VIKUNJA_ID_VERSION=v1
# SECRET_VIKUNJA_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS vikunja:~/.abra/recipes/authentik/icons/vikunja.svg"
# VIKUNJA_APPGROUP="$GROUP_ORGANISATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.outline.yml"
# OUTLINE_DOMAIN=outline.example.com
# SECRET_OUTLINE_ID_VERSION=v1
# SECRET_OUTLINE_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS outline:~/.abra/recipes/authentik/icons/outline.png"
# OUTLINE_APPGROUP="$GROUP_DOCUMENTATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.kimai.yml"
# KIMAI_DOMAIN=kimai.example.com
# SECRET_KIMAI_ID_VERSION=v1
# SECRET_KIMAI_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS kimai:~/.abra/recipes/authentik/icons/kimai_logo.png"
# KIMAI_APPGROUP="$GROUP_ORGANISATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.zammad.yml"
# ZAMMAD_DOMAIN=zammad.example.com
# APP_ICONS="$APP_ICONS zammad:~/.abra/recipes/authentik/icons/zammad.svg"
# ZAMMAD_APPGROUP="$GROUP_SUPPORT"
# COMPOSE_FILE="$COMPOSE_FILE:compose.monitoring.yml"
# MONITORING_DOMAIN=monitoring.example.com
# SECRET_MONITORING_ID_VERSION=v1
# SECRET_MONITORING_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS monitoring:~/.abra/recipes/authentik/icons/monitoring.svg"
# MONITORING_APPGROUP="$GROUP_INFRASTRUCTURE"
# COMPOSE_FILE="$COMPOSE_FILE:compose.rallly.yml"
# RALLLY_DOMAIN=rallly.example.com
# SECRET_RALLLY_ID_VERSION=v1
# SECRET_RALLLY_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS rallly:~/.abra/recipes/authentik/icons/rallly.png"
# RALLLY_APPGROUP="$GROUP_ORGANISATION"
# COMPOSE_FILE="$COMPOSE_FILE:compose.hedgedoc.yml"
# HEDGEDOC_DOMAIN=hedgedoc.example.com
# SECRET_HEDGEDOC_ID_VERSION=v1
# SECRET_HEDGEDOC_SECRET_VERSION=v1
# APP_ICONS="$APP_ICONS hedgedoc:~/.abra/recipes/authentik/icons/hedgedoc.png"
# HEDGEDOC_APPGROUP="$GROUP_DOCUMENTATION"
# APPLICATIONS='{"Calendar": "https://nextcloud.example.com/apps/calendar/", "BBB": "https://nextcloud.example.com/apps/bbb/", "Pretix": "https://pretix.example.com/control/"}'
# APPLICATIONS='{"Calendar": {"url":"https://nextcloud.example.com/apps/calendar/", "group": ""}, "BBB": {"url":"https://nextcloud.example.com/apps/bbb/", "group":""}, "Pretix": {"url":"https://pretix.example.com/control/", "group":""}}'
# EXTRA_ICONS={"Calendar": "~/.abra/recipes/authentik/icons/calendar.svg", "BBB": "~/.abra/recipes/authentik/icons/bbb.png", "Pretix": "~/.abra/recipes/authentik/icons/pretix.svg"}

28
abra.sh
View File

@ -177,6 +177,7 @@ print(f'{blueprint.name} enabled: {blueprint.enabled}')
}
# This function adds each application with its name, slug and group if passed
add_applications(){
export APPLICATIONS
/manage.py shell -c """
@ -185,19 +186,42 @@ import os
if os.environ['APPLICATIONS'] == '':
exit()
applications = json.loads(os.environ['APPLICATIONS'])
for name, url in applications.items():
print(f'Add {name}: {url}')
for name, details in applications.items():
url = details['url']
app = Application.objects.filter(name=name).first()
if not app:
app = Application()
app.name = name
app.slug = name.replace(' ', '-')
app.meta_launch_url = url
group = details['group']
if group:
app.group = group
print(f'Add {name}: {url} in group: {group}')
else:
print(f'Add {name}: {url}')
app.open_in_new_tab = True
app.save()
""" 2>&1 | quieten
}
## This function is for renaming apps - usage: rename "old name" "new name"
rename() {
/manage.py shell -c """
old_name = '$1'
new_name = '$2' if '$2' else old_name
app = Application.objects.filter(name=old_name).first()
if app:
app.name = new_name
app.save()
print(f'Renamed application from {old_name} to {new_name}')
else:
print(f'No application found with name: {old_name}')
""" > /dev/null 2>&1
}
quieten(){
# 'SyntaxWarning|version_regex|"http\['