-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: add example env file for easier environment variable management #685
Open
Kat-Alo
wants to merge
5
commits into
themarshallproject:develop
Choose a base branch
from
washingtonpost:napps-1234-new-contribution-branch
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d0c5132
updating DEVELOPING docs with new example env
Kat-Alo eac49a1
adding .env.local.example
Kat-Alo 67fbc17
resolving docker-compose merge conflicts
Kat-Alo dff1ae7
merge conflict: tracking example env files but not actual env files
Kat-Alo ed46db3
deleting docker-compose to be consistent with develop
Kat-Alo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
network_mode: service:db | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
env_file: | ||
- .env.local | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql | ||
env_file: | ||
- .env.local | ||
# Your config/database.yml should use the user and password you set here, | ||
# and host "db" (as that's the name of this service). You can use whatever | ||
# database name you want. Use `bin/rails db:prepare` to create the database. | ||
# | ||
# Example: | ||
# | ||
# development: | ||
# <<: *default | ||
# host: db | ||
# username: postgres | ||
# password: postgres | ||
# database: myapp_development | ||
|
||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
volumes: | ||
postgres-data: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# App settings | ||
RACK_ENV=development | ||
RAILS_ENV=development | ||
HOST='localhost:3000' | ||
PORT=3000 | ||
|
||
# DB settings needed only for db creation | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_DB=klaxon | ||
POSTGRES_HOST=db | ||
|
||
# Postgres URI pattern is postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...] | ||
DATABASE_URL="postgres://postgres:postgres@db:5432/klaxon" | ||
SECRET_KEY_BASE="secret_key_base" | ||
ADMIN_EMAILS="[email protected]" # comma-separated list of email addresses | ||
|
||
# Email config if using Sendgrid | ||
SENDGRID_USERNAME= | ||
SENDGRID_PASSWORD= | ||
|
||
# Email config if using Amazon SES | ||
SMTP_PROVIDER= # SES | ||
SES_ADDRESS= | ||
SES_USERNAME= | ||
SES_PASSWORD= | ||
SES_DOMAIN= | ||
MAILER_FROM_ADDRESS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ snapshots | |
|
||
/app/assets/builds/* | ||
!/app/assets/builds/.keep | ||
|
||
.env* | ||
!.env.*.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,13 @@ gem install bundler | |
bundle install | ||
``` | ||
|
||
In order to be allowed to login to Klaxon once it's running on your machine, it'll need to know that your email address is. Create a file named `.env` and paste in these two items: | ||
In order to be allowed to login to Klaxon once it's running on your machine, it'll need to know that your email address is. Create an env file for local development like so: | ||
|
||
``` | ||
ADMIN_EMAILS="[email protected]" | ||
HOST='localhost:5000' | ||
cp .env.local.example .env.local | ||
``` | ||
|
||
Feel free to substitute in your email address. In development, Klaxon doesn't actually send emails locally, so a real address is not required. | ||
Feel free to substitute in your email address in `ADMIN_EMAILS`. In development, Klaxon doesn't actually send emails locally, so a real address is not required. But, those will be the addresses used to log into the app. | ||
|
||
Now that's set, you'll run a couple of commands for Rails to create Klaxon's database on your machine. | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't honestly say I know how I mangled the git history here, but the diff should only be the switch from using environment variables to an env file like shown in this duplicate (and now closed) PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, I see now. Y'all purged docker files on develop. I can definitely just nix this file, but thinking more about how this impacts the PRs we have in the queue... 🤔