From 56a6c1de545086434f8ed1e731c20a6c6f06251e Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Wed, 10 Jun 2026 09:28:16 +0200 Subject: [PATCH 1/3] feat: replace dotenv-rails with mise for env management 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 --- .gitignore | 2 ++ AGENTS.md | 37 +++++++++++++++++++++-------- Gemfile | 2 +- Gemfile.lock | 5 ---- README.md | 25 ++++++++++--------- config/database.yml | 1 + docker-compose.override.yml.example | 5 ++++ mise.local.toml.example | 3 +++ mise.toml | 3 +++ 9 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 docker-compose.override.yml.example create mode 100644 mise.local.toml.example create mode 100644 mise.toml diff --git a/.gitignore b/.gitignore index 11e86f128..dac54eff9 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,8 @@ TAGS .env +mise.local.toml +docker-compose.override.yml .DS_Store .byebug_history diff --git a/AGENTS.md b/AGENTS.md index 1fedbd75f..9103978d0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,9 +27,21 @@ codebar planner is a Rails 8.1 application for managing [codebar.io](https://cod **IMPORTANT**: Always use native installation with `bundle exec` commands. Never use Docker or `bin/d*` commands. +### Prerequisites + +- **mise** — install via `brew install mise`, then enable `mise activate` in your shell profile (see [mise docs](https://mise.jdx.dev/getting-started.html)). Alternatively, use `mise exec` to run commands with project env vars without shell activation. +- PostgreSQL running locally (default port 5432, or configure via `DB_PORT`) + ### Native Installation -- **Setup**: `bundle && rake db:create db:migrate db:seed` +``` +cp mise.local.toml.example mise.local.toml +# Edit mise.local.toml with your GitHub OAuth credentials +# Optionally delete .env if it exists from a prior setup: +rm .env +bundle && rake db:create db:migrate db:seed +``` + - **Server**: `bundle exec rails server` - **Tests**: `make test` or `bundle exec parallel_rspec spec/ -n 3` - runs RSpec tests in parallel (3 processes is optimal) - **Single test**: `bundle exec rspec spec/path/to/file_spec.rb:42` @@ -37,20 +49,25 @@ codebar planner is a Rails 8.1 application for managing [codebar.io](https://cod - **Run rake tasks**: `bundle exec rake [task]` - **Linting**: `bundle exec rubocop` -### Docker Setup (Not Used) - -Docker setup exists in this repository (`bin/d*` commands) but is **not used** for development work with Claude Code, OpenCode, etc. - ### Environment Variables -Required in `.env` file: -``` -GITHUB_KEY= -GITHUB_SECRET= -``` +Managed by `mise` via `mise.toml` (shared, committed) and `mise.local.toml` (secrets, gitignored). Automatically loaded when you enter the project directory (requires `mise activate`). + +| Variable | Default | Description | +|----------|---------|-------------| +| `DB_HOST` | `localhost` | Postgres host | +| `DB_PORT` | `5432` | Postgres port | +| `DB_USER` | (empty) | Postgres user | +| `POSTGRES_PASSWORD` | (empty) | Postgres password | +| `GITHUB_KEY` | — | GitHub OAuth client ID (set in `mise.local.toml`) | +| `GITHUB_SECRET` | — | GitHub OAuth client secret (set in `mise.local.toml`) | Create GitHub OAuth app at https://github.com/settings/applications/new with callback URL `http://localhost:3000/auth/github`. +### Docker Setup (Not Used) + +Docker setup exists in this repository (`bin/d*` commands) but is **not used** for development work with Claude Code, OpenCode, etc. + ## Architecture & Domain Model ### Core Domain Concepts diff --git a/Gemfile b/Gemfile index 2c117a7f8..63b23c265 100644 --- a/Gemfile +++ b/Gemfile @@ -87,7 +87,7 @@ group :development do end group :development, :test do - gem 'dotenv-rails' + gem 'fabrication' gem 'faker' gem 'irb' # LOCKED: Added because of byebug diff --git a/Gemfile.lock b/Gemfile.lock index cabc8f0ed..9d4f239e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -182,10 +182,6 @@ GEM delayed_job (>= 3.0, < 5) diff-lcs (1.6.2) docile (1.4.0) - dotenv (3.2.0) - dotenv-rails (3.2.0) - dotenv (= 3.2.0) - railties (>= 6.1) drb (2.2.3) email_validator (2.2.4) activemodel @@ -634,7 +630,6 @@ DEPENDENCIES database_cleaner delayed_job delayed_job_active_record - dotenv-rails drb email_validator fabrication diff --git a/README.md b/README.md index 0c0ac1de9..65880dc9c 100644 --- a/README.md +++ b/README.md @@ -42,23 +42,26 @@ Visit [https://github.com/settings/applications/new](https://github.com/settings #### Add your application details to your environment variables -##### Mac/Linux: -1. Run `touch .env` to create a file named `.env` in the root of the application folder. -2. Open this .env file in a text editor, and add the GitHub key (Client ID) and secret (Client Secret) like so: +**Native installation (recommended):** Copy `mise.local.toml.example` to `mise.local.toml` +and fill in your GitHub key and secret: + ``` - GITHUB_KEY=YOUR_KEY - GITHUB_SECRET=YOUR_SECRET +cp mise.local.toml.example mise.local.toml +# Edit mise.local.toml with your values ``` -##### Windows: -Windows doesn't like creating a file named `.env`, so run the following -from a command prompt in your project folder: +Environment variables are managed by [mise](https://mise.jdx.dev). Install it +with `brew install mise` and enable `mise activate` in your shell profile. + +**Docker installation:** Copy `docker-compose.override.yml.example` to +`docker-compose.override.yml` and fill in your GitHub key and secret: + ``` - echo GITHUB_KEY=YOUR_KEY >> .env - echo GITHUB_SECRET=YOUR_SECRET >> .env +cp docker-compose.override.yml.example docker-compose.override.yml +# Edit docker-compose.override.yml with your values ``` -**Note:** If when starting the application with Docker you get the error `UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte` this may be because you created the `.env`-file using PowerShell. This can be solved by deleting that file and creating a new one using a bash shell (for example Git Bash). +Docker Compose automatically merges this file — no extra configuration needed. ### 3. Install and set up the environment using docker diff --git a/config/database.yml b/config/database.yml index c25f62900..419199e5b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -6,6 +6,7 @@ development: &default username: <%= ENV['DB_USER'] || '' %> password: <%= ENV['POSTGRES_PASSWORD'] || '' %> host: <%= (ENV['DB_HOST'] || 'localhost').to_json %> + port: <%= ENV['DB_PORT'] || 5432 %> test: <<: *default diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example new file mode 100644 index 000000000..afc8c6330 --- /dev/null +++ b/docker-compose.override.yml.example @@ -0,0 +1,5 @@ +services: + web: + environment: + GITHUB_KEY: your_github_oauth_client_id + GITHUB_SECRET: your_github_oauth_client_secret diff --git a/mise.local.toml.example b/mise.local.toml.example new file mode 100644 index 000000000..997f9fbc7 --- /dev/null +++ b/mise.local.toml.example @@ -0,0 +1,3 @@ +[env] +GITHUB_KEY = "your_github_oauth_client_id" +GITHUB_SECRET = "your_github_oauth_client_secret" diff --git a/mise.toml b/mise.toml new file mode 100644 index 000000000..60e17f931 --- /dev/null +++ b/mise.toml @@ -0,0 +1,3 @@ +[env] +DB_HOST = "localhost" +DB_PORT = "5432" From 2384a61ccdd84a336d197037912e3f6456ce29e4 Mon Sep 17 00:00:00 2001 From: Morgan Roderick <20321+mroderick@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:43:53 +0200 Subject: [PATCH 2/3] Update Gemfile Co-authored-by: Olle Jonsson --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 63b23c265..25473c54d 100644 --- a/Gemfile +++ b/Gemfile @@ -87,7 +87,6 @@ group :development do end group :development, :test do - gem 'fabrication' gem 'faker' gem 'irb' # LOCKED: Added because of byebug From eda7f180c6ee60fec96dc45f238abaa6e542b81e Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Wed, 10 Jun 2026 18:50:10 +0200 Subject: [PATCH 3/3] chore(docker): inline env vars and remove docker-compose.env 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 --- .gitignore | 1 + docker-compose.env | 3 --- docker-compose.yml | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 docker-compose.env diff --git a/.gitignore b/.gitignore index dac54eff9..e30b6712d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ TAGS .env mise.local.toml docker-compose.override.yml +docker-compose.env .DS_Store .byebug_history diff --git a/docker-compose.env b/docker-compose.env deleted file mode 100644 index d64af3f74..000000000 --- a/docker-compose.env +++ /dev/null @@ -1,3 +0,0 @@ -DB_HOST=db -DB_USER=postgres -POSTGRES_PASSWORD=password diff --git a/docker-compose.yml b/docker-compose.yml index 71701fe47..4da6180fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,12 +8,13 @@ services: environment: POSTGRES_PASSWORD: password web: - env_file: - - docker-compose.env build: . command: tail -f /dev/null environment: DB_HOST: db + DB_PORT: 5432 + DB_USER: postgres + POSTGRES_PASSWORD: password volumes: - .:/planner - gem_cache:/usr/local/bundle/gems