Skip to content

Commit

Permalink
Merge branch 'main' into dep-psycopg3
Browse files Browse the repository at this point in the history
  • Loading branch information
offbyone authored Oct 16, 2024
2 parents 719b651 + e5d94e6 commit c903d90
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ jobs:
# still in prerelease
uv sync --prerelease=allow
scripts/get_web_port.sh
just resetdb
just bootstrap
- name: Set up Docker and docker buildx
Expand Down
4 changes: 4 additions & 0 deletions convention-template/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ bootstrap:
scripts/get_local_docker_ports.sh
scripts/get_web_port.sh
# if our .env isn't there, this is probably a checkout;
# we want to generate it instead.
scripts/ensure_env.sh

# we run this again to get the new environment locked in
docker compose up -d

Expand Down
36 changes: 36 additions & 0 deletions convention-template/scripts/ensure_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

if test -f .env; then
echo ".env already exists; skipping"
exit 0
fi

SECRET_KEY=$(head -c 16 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')
DB_PASSWORD=$(head -c 16 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')
FLOWER_PASSWORD=$(head -c 16 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')

cat <<EOF >>.env
# During development, you may not have OAuth; this allows usernames
NOM_ALLOW_USERNAME_LOGIN=true
NOM_DEBUG=True
NOM_SECRET_KEY="$SECRET_KEY"
NOM_DB_NAME=nominate
NOM_DB_USER=postgres
NOM_DB_PASSWORD="$DB_PASSWORD"
NOM_DB_PORT=5432
NOM_DB_HOST=localhost
NOM_REDIS_HOST=localhost
NOM_REDIS_PORT=6379
NOM_ALLOWED_HOSTS=127.0.0.1,localhost
NOM_OAUTH_KEY=bogon
NOM_OAUTH_SECRET=bogon
NOM_OAUTH_BACKEND=nom.oauth2_backends.DummyOAuth2Backend
NOM_EMAIL_HOST=localhost
NOM_EMAIL_PORT=51025
CELERY_FLOWER_USER=flower
CELERY_FLOWER_PASSWORD="$FLOWER_PASSWORD"
EOF

0 comments on commit c903d90

Please sign in to comment.