better env (#1082)

This commit is contained in:
Keyan 2024-04-16 19:23:36 -05:00 committed by GitHub
parent 058f88da49
commit bc85a63091
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 38 deletions

View File

@ -1,6 +1,6 @@
############################################################################
# AUTH / OPTIONAL #
# if you want to work on logged in features, you'll need some kind of auth #
# OPTIONAL SECRETS #
# put these in .env.local, and don't commit them to git #
############################################################################
# github
@ -11,16 +11,9 @@ GITHUB_SECRET=
TWITTER_ID=
TWITTER_SECRET=
# email
LOGIN_EMAIL_SERVER=smtp://mailhog:1025
LOGIN_EMAIL_FROM=sndev@mailhog.dev
# email list
LIST_MONK_AUTH=
########################################################
# OTHER / OPTIONAL #
# configuration for push notifications, slack are here #
########################################################
# VAPID for Web Push
VAPID_MAILTO=
NEXT_PUBLIC_VAPID_PUBKEY=
@ -34,9 +27,14 @@ SLACK_CHANNEL_ID=
LNAUTH_URL=
LNWITH_URL=
#########################
# SNDEV STUFF WE PRESET #
#########################
########################################
# SNDEV STUFF WE PRESET #
# which you can override in .env.local #
########################################
# email
LOGIN_EMAIL_SERVER=smtp://mailhog:1025
LOGIN_EMAIL_FROM=sndev@mailhog.dev
# static things
NEXTAUTH_URL=http://localhost:3000/api/auth
@ -94,10 +92,6 @@ NEXT_PUBLIC_NORMAL_POLL_INTERVAL=30000
NEXT_PUBLIC_LONG_POLL_INTERVAL=60000
NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL=300000
###################
# FOR DOCKER ONLY #
###################
# containers can't use localhost, so we need to use the container name
IMGPROXY_URL_DOCKER=http://imgproxy:8080
MEDIA_URL_DOCKER=http://s3:4566/uploads

18
.env.production Normal file
View File

@ -0,0 +1,18 @@
LIST_MONK_URL=https://mail.stacker.news
LNAUTH_URL=https://stacker.news/api/lnauth
LND_CONNECT_ADDRESS=03cc1d0932bb99b0697f5b5e5961b83ab7fd66f1efc4c9f5c7bad66c1bcbe78f02@52.5.194.83:9735
LNWITH_URL=https://stacker.news/api/lnwith
LOGIN_EMAIL_FROM=login@stacker.news
NEXTAUTH_URL=https://stacker.news
NEXTAUTH_URL_INTERNAL=http://127.0.0.1:8080/api/auth
NEXT_PUBLIC_AWS_UPLOAD_BUCKET=snuploads
NEXT_PUBLIC_IMGPROXY_URL=https://imgprxy.stacker.news/
NEXT_PUBLIC_MEDIA_DOMAIN=m.stacker.news
PUBLIC_URL=https://stacker.news
SELF_URL=http://127.0.0.1:8080
grpc_proxy=http://127.0.0.1:7050
NEXT_PUBLIC_FAST_POLL_INTERVAL=1000
NEXT_PUBLIC_NORMAL_POLL_INTERVAL=30000
NEXT_PUBLIC_LONG_POLL_INTERVAL=60000
NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL=300000
NEXT_PUBLIC_URL=https://stacker.news

4
.gitignore vendored
View File

@ -28,9 +28,9 @@ yarn-debug.log*
yarn-error.log*
# local env files
envbak
.env*
!.env.sample
!.env.development
!.env.production
# local settings
.vscode/settings.json

19
sndev
View File

@ -62,25 +62,6 @@ docker__stacker_cln() {
sndev__start() {
shift
if ! [ -f .env.development ]; then
echo ".env.development does not exist ... creating from .env.sample"
cp .env.sample .env.development
elif ! git diff --exit-code --diff-algorithm=histogram .env.sample .env.development; then
echo ".env.development is different from .env.sample ..."
printf "do you want to merge .env.sample into .env.development? [y/N] "
read -r answer
if [ "$answer" = "y" ]; then
# merge .env.sample into .env.development in a posix compliant way
git merge-file --theirs .env.development /dev/fd/3 3<<-EOF /dev/fd/4 4<<-EOF
$(git show HEAD:.env.sample)
EOF
$(cat .env.sample)
EOF
else
echo "merge cancelled"
fi
fi
if [ $# -eq 0 ]; then
docker__compose up --build
exit 0