From 30768016fdcf807bbb831a3b7e305cde48b4a1c5 Mon Sep 17 00:00:00 2001 From: brooke Date: Fri, 25 Apr 2025 14:50:04 -0400 Subject: [PATCH] update account creation process to use abra cmd to fix issues with postgres secrets not being properly handled --- README.md | 6 +++--- abra.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0edf433..78a8841 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,13 @@ COMPOSE_FILE="$COMPOSE_FILE:compose.postgres.yml" ## [Add your first account](https://docs.gotosocial.org/en/latest/getting_started/user_creation/) Create the account ->Note: Redeploying the app is required after creating new accounts using the cli, this is expected to change in future updates of GtS +> Note: Redeploying the app is required after creating or promoting new accounts using the cli, this is expected to change in future updates of GtS ``` -abra app run app ./gotosocial admin account create --username --email --password '' +abra app cmd app newuser '' ``` Make them an admin ``` -abra app run app ./gotosocial admin account promote --username +abra app cmd app admin ``` ## [Federation mode](https://docs.gotosocial.org/en/latest/admin/federation_modes/) diff --git a/abra.sh b/abra.sh index 9abba17..bd67be8 100644 --- a/abra.sh +++ b/abra.sh @@ -1,3 +1,51 @@ export ENTRYPOINT_VERSION=v1 export PG_BACKUP_VERSION=v1 -export CONFIG_VERSION=v1 \ No newline at end of file +export CONFIG_VERSION=v1 + +environment() { + if [ -f /run/secrets/oidc_secret ]; then + export GTS_OIDC_CLIENT_SECRET=$(cat /run/secrets/oidc_secret) + else + echo "OIDC secret not found, skipping." + fi + + if [ -f /run/secrets/smtp_password ]; then + export GTS_SMTP_PASSWORD=$(cat /run/secrets/smtp_password) + else + echo "SMTP password secret not found, skipping." + fi + + if [ -f /run/secrets/db_password ]; then + export GTS_DB_PASSWORD=$(cat /run/secrets/db_password) + else + echo "DB password secret not found, skipping." + fi +} + +newuser() { + environment + + USERNAME="$1" + EMAIL="$2" + PASSWORD="$3" + + if [ -z "$USERNAME" ] || [ -z "$EMAIL" ] || [ -z "$PASSWORD" ]; then + echo "Usage: abra app cmd admin -- " + exit 1 + fi + + ./gotosocial admin account create --username "$USERNAME" --email "$EMAIL" --password "$PASSWORD" +} + +admin() { + environment + + USERNAME="$1" + + if [ -z "$USERNAME" ]; then + echo "Usage: abra app cmd admin " + exit 1 + fi + + ./gotosocial admin account promote --username "$USERNAME" +}