Skip to content

feat: replace dotenv-rails with mise for env management#2639

Open
mroderick wants to merge 4 commits into
masterfrom
feature/mise-env-migration
Open

feat: replace dotenv-rails with mise for env management#2639
mroderick wants to merge 4 commits into
masterfrom
feature/mise-env-migration

Conversation

@mroderick

@mroderick mroderick commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

The local development setup is a bit clunky for me still, because it assumes that Postgres is running on the default port.

I do other work on the same machine, and would like to at least be able to specify which Postgres port to use.

I've been having good results with using mise in my day job, so I am proposing that we use that (or set environment variables manually for those that prefer that), which allows us to also drop dotenv and dotenv-rails. I prefer to have fewer dependencies to manage.


Replace dotenv-rails + .env with mise for environment variable management. Add DB_PORT support to database.yml for running multiple Postgres instances.

Changes

  • Create mise.toml — shared env defaults (DB_HOST, DB_PORT)
  • Create mise.local.toml.example — template for local secrets (native install)
  • Create docker-compose.override.yml.example — template for Docker users
  • Add DB_PORT support to config/database.yml
  • Add mise.local.toml and docker-compose.override.yml to .gitignore
  • Remove dotenv-rails gem
  • Update AGENTS.md and README.md with new setup workflows

Migration for Contributors

Native:

  1. brew install mise and add mise activate to shell profile
  2. cp mise.local.toml.example mise.local.toml and fill in GitHub OAuth creds
  3. bundle install (removes dotenv-rails)
  4. (Optional) rm .env

Docker:

  1. cp docker-compose.override.yml.example docker-compose.override.yml
  2. Fill in GitHub OAuth creds
  3. No .env file needed

Remove dotenv-rails gem and migrate env var loading to mise.
Add DB_PORT support to database.yml for configurable Postgres.

- Create mise.toml with shared env defaults (DB_HOST, DB_PORT)
- Create mise.local.toml.example as a template for local secrets
- Create docker-compose.override.yml.example for Docker users to inject
  GitHub OAuth credentials without dotenv-rails or .env files
- Add port: to config/database.yml via DB_PORT env var
- Add mise.local.toml and docker-compose.override.yml to .gitignore
- Remove gem 'dotenv-rails' from Gemfile
- Update AGENTS.md and README with new setup workflows

Native install: cp mise.local.toml.example mise.local.toml
Docker install: cp docker-compose.override.yml.example docker-compose.override.yml
@mroderick mroderick force-pushed the feature/mise-env-migration branch from f653494 to 56a6c1d Compare June 10, 2026 07:28
@mroderick mroderick requested review from olleolleolle and till June 10, 2026 07:45
@mroderick mroderick marked this pull request as ready for review June 10, 2026 07:45

@olleolleolle olleolleolle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it is easier to teach mise than the previous system.

Comment thread Gemfile Outdated
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>

@till till left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of toml 🫣, I prefer direnv. But I agree this looks easier than what was there before.

@olleolleolle

Copy link
Copy Markdown
Collaborator

Another, that we use at work is Shadowenv.

@mroderick

Copy link
Copy Markdown
Collaborator Author

Suggestion: Add DB_PORT to docker-compose.env for parity with the mise.toml setup.

The PR adds DB_PORT to config/database.yml and mise.toml for native installs, but the Docker web service currently relies on the implicit Postgres default. For consistency across both setups, could we add DB_PORT=5432 to docker-compose.env?

# docker-compose.env
 DB_HOST=db
+DB_PORT=5432
 DB_USER=postgres
 POSTGRES_PASSWORD=password

This keeps the web service explicitly aligned with the same env var contract used in database.yml, and makes it clearer to anyone overriding the file that the port is configurable. The internal container port stays 5432 (the db service maps to host 5433 to avoid clashing with native Postgres), so no changes to the db ports section are needed.

What do you think?

@till

till commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Maybe get rid off docker-compose.env? No need to maintain 2 files.

Moves DB_HOST, DB_USER, POSTGRES_PASSWORD into docker-compose.yml
inline environment block, removing the need for a separate env file.
Adds DB_PORT for parity with the native mise.toml setup.
Also adds docker-compose.env to .gitignore to prevent accidental recreation.

Suggested-by: Till <till@example.com>
… feature/mise-env-migration

* origin/feature/mise-env-migration:
  Update Gemfile
@olleolleolle

Copy link
Copy Markdown
Collaborator

Nice that we got improvements in, good discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants