diff --git a/.env.sample b/.env.sample index d28e87e..76d6707 100644 --- a/.env.sample +++ b/.env.sample @@ -1,7 +1,7 @@ TYPE=authentik TIMEOUT=300 ENABLE_AUTO_UPDATE=true -POST_DEPLOY_CMDS="app set_admin_pass|worker apply_blueprints" +POST_DEPLOY_CMDS="worker set_admin_pass|worker apply_blueprints|worker add_applications" LETS_ENCRYPT_ENV=production DOMAIN=authentik.example.com @@ -71,3 +71,7 @@ COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" # SECRET_VIKUNJA_ID_VERSION=v1 # SECRET_VIKUNJA_SECRET_VERSION=v1 # APP_ICONS="$APP_ICONS vikunja:~/.abra/recipes/authentik/icons/vikunja.svg" + +# APPLICATIONS='{"Calendar": "https://nextcloud.example.com/apps/calendar/", "Rallly":"https://rallly.example.cloud/"}' +# APP_ICONS="$APP_ICONS Calendar:~/.abra/recipes/authentik/icons/calendar.svg" +# APP_ICONS="$APP_ICONS Rallly:~/.abra/recipes/authentik/icons/rallly.png" diff --git a/abra.sh b/abra.sh index 6658555..d3180c5 100644 --- a/abra.sh +++ b/abra.sh @@ -50,7 +50,7 @@ else: key=key, ) print('Created authentik-bootstrap-token') -""" +""" 2>&1 | quieten } rotate_db_pass() { @@ -62,8 +62,8 @@ apply_blueprints() { enable_blueprint default/flow-default-authentication-flow.yaml enable_blueprint default/flow-default-user-settings-flow.yaml enable_blueprint default/flow-password-change.yaml - ak apply_blueprint 6_flow_invalidation.yaml - ak apply_blueprint 5_system_tenant.yaml + ak apply_blueprint 6_flow_invalidation.yaml 2>&1 | quieten + ak apply_blueprint 5_system_tenant.yaml 2>&1 | quieten disable_blueprint default/flow-default-authentication-flow.yaml disable_blueprint default/flow-default-user-settings-flow.yaml disable_blueprint default/flow-password-change.yaml @@ -84,10 +84,34 @@ blueprint_path='$2' blueprint = BlueprintInstance.objects.filter(path=blueprint_path).first() blueprint.enabled = blueprint_state print(f'{blueprint.name} enabled: {blueprint.enabled}') -""" +""" 2>&1 | quieten } +add_applications(){ +/manage.py shell -c """ +import json +if '$APPLICATIONS' == '': + exit() +applications = json.loads('$APPLICATIONS') +for name, url in applications.items(): + print(f'Add {name}: {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 + app.open_in_new_tab = True + app.save() +""" 2>&1 | quieten +} + + +quieten(){ + grep -v '{"event"' +} + set_icons(){ for icon in $APP_ICONS; do app=$(echo $icon | cut -d ":" -f1) @@ -126,6 +150,6 @@ Flow.objects.filter(slug__in=delete_flows).delete() Stage.objects.filter(flow=None).delete() Prompt.objects.filter(promptstage=None).delete() Tenant.objects.filter(default=True).delete() -""" +""" 2>&1 | quieten apply_blueprints } diff --git a/compose.yml b/compose.yml index 3bf841d..3e59403 100644 --- a/compose.yml +++ b/compose.yml @@ -27,6 +27,7 @@ x-env: &env - EMAIL_TOKEN_EXPIRY_MINUTES - DOMAIN - LOGOUT_REDIRECT + - APPLICATIONS version: '3.8' services: diff --git a/icons/calendar.svg b/icons/calendar.svg new file mode 100644 index 0000000..4f2a9cf --- /dev/null +++ b/icons/calendar.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/icons/rallly.png b/icons/rallly.png new file mode 100644 index 0000000..e654aae Binary files /dev/null and b/icons/rallly.png differ