Skip to content

Commit

Permalink
feat: enable runtime configuration reloads for auth
Browse files Browse the repository at this point in the history
This is a small diff doing three things:

- Create the `/etc/auth.d` directory.
- Copies the `gotrue-optimizations.service.j2` to also copy the
  `gotrue.generated.env` file to the `/etc/auth.d` directory.
- Change the `gotrue.service.j2` to use the `--config-dir` flag
  set to the newly created `/etc/auth.d` directory.
  • Loading branch information
Chris Stockton committed Jan 27, 2025
1 parent ebe4431 commit 2295cd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions ansible/files/gotrue-optimizations.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Description=GoTrue (Auth) optimizations
Type=oneshot
# we don't want failures from this command to cause PG startup to fail
ExecStart=/bin/bash -c "/opt/supabase-admin-api optimize auth --destination-config-file-path /etc/gotrue/gotrue.generated.env ; exit 0"
ExecStartPost=/bin/bash -c "cp -a /etc/gotrue/gotrue.generated.env /etc/auth.d/20_generated.env ; exit 0"
User=postgrest

[Install]
Expand Down
2 changes: 1 addition & 1 deletion ansible/files/gotrue.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description=Gotrue
[Service]
Type=simple
WorkingDirectory=/opt/gotrue
ExecStart=/opt/gotrue/gotrue
ExecStart=/opt/gotrue/gotrue --config-dir /etc/auth.d
User=gotrue
Restart=always
RestartSec=3
Expand Down
7 changes: 7 additions & 0 deletions ansible/tasks/setup-gotrue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
owner: gotrue
mode: 0775

- name: gotrue - create /etc/auth.d
file:
path: /etc/auth.d
state: directory
owner: gotrue
mode: 0755

- name: gotrue - unpack archive in /opt/gotrue
unarchive:
remote_src: yes
Expand Down

0 comments on commit 2295cd0

Please sign in to comment.