From bc85a630919904ffc4c562de09fb0094d24a8d4c Mon Sep 17 00:00:00 2001 From: Keyan <34140557+huumn@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:23:36 -0500 Subject: [PATCH] better env (#1082) --- .env.sample => .env.development | 28 +++++++++++----------------- .env.production | 18 ++++++++++++++++++ .gitignore | 4 ++-- sndev | 19 ------------------- 4 files changed, 31 insertions(+), 38 deletions(-) rename .env.sample => .env.development (92%) create mode 100644 .env.production diff --git a/.env.sample b/.env.development similarity index 92% rename from .env.sample rename to .env.development index d4b83bcc..172d9bd6 100644 --- a/.env.sample +++ b/.env.development @@ -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 diff --git a/.env.production b/.env.production new file mode 100644 index 00000000..4e213eeb --- /dev/null +++ b/.env.production @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7c3352a2..39b18a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/sndev b/sndev index 7020ef07..20dd18b9 100755 --- a/sndev +++ b/sndev @@ -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