RepoPilotOpen in app →

rubyconfig/config

Easiest way to add multi-environment yaml settings to Rails, Sinatra, Padrino and other Ruby projects.

Mixed

Slowing — last commit 3mo ago

worst of 4 axes
Use as dependencyConcerns

non-standard license (Other)

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 3mo ago
  • 27+ active contributors
  • Distributed ownership (top contributor 37% of recent commits)
Show 5 more →
  • Other licensed
  • CI configured
  • Tests present
  • Slowing — last commit 3mo ago
  • Non-standard license (Other) — review terms
What would change the summary?
  • Use as dependency ConcernsMixed if: clarify license terms

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Forkable" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Forkable
[![RepoPilot: Forkable](https://repopilot.app/api/badge/rubyconfig/config?axis=fork)](https://repopilot.app/r/rubyconfig/config)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/rubyconfig/config on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: rubyconfig/config

Generated by RepoPilot · 2026-05-10 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/rubyconfig/config shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

WAIT — Slowing — last commit 3mo ago

  • Last commit 3mo ago
  • 27+ active contributors
  • Distributed ownership (top contributor 37% of recent commits)
  • Other licensed
  • CI configured
  • Tests present
  • ⚠ Slowing — last commit 3mo ago
  • ⚠ Non-standard license (Other) — review terms

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live rubyconfig/config repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/rubyconfig/config.

What it runs against: a local clone of rubyconfig/config — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in rubyconfig/config | Confirms the artifact applies here, not a fork | | 2 | License is still Other | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 131 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>rubyconfig/config</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of rubyconfig/config. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/rubyconfig/config.git
#   cd config
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of rubyconfig/config and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "rubyconfig/config(\\.git)?\\b" \\
  && ok "origin remote is rubyconfig/config" \\
  || miss "origin remote is not rubyconfig/config (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Other)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Other\"" package.json 2>/dev/null) \\
  && ok "license is Other" \\
  || miss "license drift — was Other at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "lib/config.rb" \\
  && ok "lib/config.rb" \\
  || miss "missing critical file: lib/config.rb"
test -f "lib/config/configuration.rb" \\
  && ok "lib/config/configuration.rb" \\
  || miss "missing critical file: lib/config/configuration.rb"
test -f "lib/config/options.rb" \\
  && ok "lib/config/options.rb" \\
  || miss "missing critical file: lib/config/options.rb"
test -f "lib/config/sources/yaml_source.rb" \\
  && ok "lib/config/sources/yaml_source.rb" \\
  || miss "missing critical file: lib/config/sources/yaml_source.rb"
test -f "lib/config/integrations/rails/railtie.rb" \\
  && ok "lib/config/integrations/rails/railtie.rb" \\
  || miss "missing critical file: lib/config/integrations/rails/railtie.rb"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 131 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~101d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/rubyconfig/config"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

Config is a Ruby gem that provides simple YAML-based environment-specific settings management for Rails, Sinatra, Padrino, and other Ruby projects. It lets developers define settings in config/settings.yml and environment-specific overrides (development/production/test), access them via object notation like Settings.database.host, and supports ERB templating and settings inheritance—solving the problem of managing secrets, API keys, and configuration across environments without hardcoding. Monolithic gem structure: lib/config/ contains the core engine (Configuration class in lib/config/configuration.rb), framework integrations live in lib/config/integrations/ (Rails railtie, Sinatra, Heroku), validation logic is in lib/config/validation/, and sources (YAML, ENV, Hash) are in lib/config/sources/. Generators in lib/generators/config/ scaffold new Rails projects with template settings files.

👥Who it's for

Ruby developers building Rails, Sinatra, or Padrino applications who need to manage environment-specific configuration (API keys, database URLs, feature flags) across development, test, and production without committing secrets to version control or using ENV variables for every setting.

🌱Maturity & risk

Production-ready and actively maintained. The gem has strong test coverage (CI runs in .github/workflows/tests.yml), supports Ruby 2.6+, Rails 5.2+, and maintains a detailed CHANGELOG. Last activity visible in file structure shows organized releases and ongoing support for multiple Ruby interpreters (Ruby, JRuby, TruffleRuby).

Low risk: the gem has a narrow, well-defined scope (YAML config loading) with minimal external dependencies visible in the structure. The main risk is maintainer availability—open an issue to verify the project response time. Breaking changes are unlikely given semantic versioning (see CHANGELOG.md) and the stable Ruby/Rails ecosystem it targets.

Active areas of work

The repo is actively maintained with organized test workflows, generators for Rails scaffold, and integrations for multiple frameworks. Recent structure suggests focus on: multi-source settings loading (yaml_source.rb, env_source.rb, hash_source.rb), validation with dry-validation (dry_validation_requirements.rb), and framework-specific initialization (rails/railtie.rb, sinatra.rb).

🚀Get running

git clone https://github.com/rubyconfig/config.git
cd config
bundle install
bundle exec rspec

Daily commands: Development: bundle exec rspec runs tests. To test with specific Rails versions: bundle exec appraise (Appraisals file configures Rails 5.2+). The gem is not meant to 'run'—it's a library you include in your Rails/Sinatra app via rails g config:install (Rails) or manual registration.

🗺️Map of the codebase

  • lib/config.rb — Main entry point and gem initialization; every contributor must understand how the gem is loaded and configured globally.
  • lib/config/configuration.rb — Core configuration class that manages Settings object creation and merging; essential for understanding how YAML is loaded and accessed.
  • lib/config/options.rb — Options parser for configuration behavior; critical for understanding how Settings behaves with different configurations.
  • lib/config/sources/yaml_source.rb — YAML file loading and ERB evaluation logic; fundamental to how environment-specific settings are parsed.
  • lib/config/integrations/rails/railtie.rb — Rails integration hook that initializes Config in Rails apps; required reading for Rails-specific behavior.
  • lib/config/validation/schema.rb — Schema validation framework; essential for understanding how configuration validation works.

🧩Components & responsibilities

  • Configuration (Ruby, YAML, ERB) — Orchestrates loading from all sources, merging, validation, and Settings object creation
    • Failure mode: Raises Config::Error if YAML is malformed, ERB evaluation fails, or validation fails; app fails to boot
  • YAML Source (Ruby, YAML, ERB) — Loads environment-specific YAML files, evaluates ERB templates, and handles file inheritance
    • Failure mode: Raises Psych::SyntaxError if YAML is invalid; silently skips missing files unless strict mode enabled
  • Env Source (Ruby, ENV hash) — Reads process environment variables and optionally converts keys to nested config values
    • Failure mode: Gracefully handles missing env vars; returns empty hash if no matching keys found
  • Schema Validator (Dry::Validation, dry-types) — Validates config structure and values against dry-validation schema contracts

🛠️How to make changes

Add a new configuration source adapter

  1. Create a new source class in lib/config/sources/ (e.g., my_custom_source.rb) that implements a load(env) method returning a Hash (lib/config/sources/)
  2. Register your source in lib/config/configuration.rb by adding it to the sources loading chain in the load_config method (lib/config/configuration.rb)
  3. Add tests in spec/ to verify your source loads and merges correctly with other sources (spec/)

Add framework integration

  1. Create a new integration file in lib/config/integrations/ (e.g., my_framework.rb) that sets up Config on framework boot (lib/config/integrations/)
  2. For Rails-like frameworks with hooks, create a Railtie-style file that calls Config.setup in lib/config/integrations/my_framework/railtie.rb (lib/config/integrations/)
  3. Update lib/config.rb to auto-load your integration when the target framework is detected (lib/config.rb)

Add schema validation rules

  1. Define your validation schema rules in a config/settings.yml.schema.yml file (or inline in config/settings.rb) (lib/generators/config/templates/)
  2. Use the dry-validation DSL in lib/config/validation/schema.rb to add custom validators (inherits from Dry::Validation::Contract) (lib/config/validation/schema.rb)
  3. Call Config.validate! or setup with validate: true option to automatically enforce schema during initialization (lib/config/configuration.rb)

Support a new YAML inheritance or ERB feature

  1. Modify the YAML parsing logic in lib/config/sources/yaml_source.rb to add new ERB helpers or inheritance syntax (lib/config/sources/yaml_source.rb)
  2. Update lib/config/dry_validation_requirements.rb if your feature introduces new validation requirements (lib/config/dry_validation_requirements.rb)
  3. Add integration tests to spec/app/rails_5.2 to verify the feature works end-to-end in a real Rails app (spec/app/rails_5.2/)

🔧Why these technologies

  • YAML — Human-readable, hierarchical format that supports ERB templates and is familiar to Rails developers for environment-specific configuration.
  • OpenStruct (Ruby) — Enables convenient dot-notation access (Settings.group.subgroup.key) without requiring predefined classes.
  • Dry::Validation — Mature, composable validation framework that allows defining configuration schemas with clear error reporting.
  • Rack middleware — Standard middleware pattern allows reloading configs on each request during development without full app restart.

⚖️Trade-offs already made

  • Merge strategy: environment variables and ENV sources override YAML files

    • Why: Allows runtime overrides (e.g., secrets in production) while maintaining sensible defaults in YAML.
    • Consequence: Developers must understand precedence order to avoid unexpected config values; harder to debug when ENV accidentally shadows YAML.
  • Single global Settings object accessed everywhere via module constant

    • Why: Convenience and simplicity; mirrors Rails.env and is familiar to Rails developers.
    • Consequence: Makes testing harder (requires resetting/mocking Settings); prevents dependency injection patterns; tight coupling to global state.
  • Validation is optional and must be explicitly enabled

    • Why: Backward compatibility; avoids breaking existing apps that don't define schemas.
    • Consequence: Silently invalid configs may not be caught until runtime; users must opt-in to safety.
  • ERB evaluation in YAML files

    • Why: Allows dynamic values (e.g., environment variables, Ruby expressions) without needing a separate template step.
    • Consequence: Unexpected Ruby code in YAML can introduce security risks if YAML contains untrusted input; harder to debug template errors.

🚫Non-goals (don't propose these)

  • Does not perform secrets management (e.g., decryption, key rotation); users must integrate external tools like Rails credentials or HashiCorp Vault.
  • Does not support real-time config updates without app restart (except in development mode via Rack middleware).
  • Does not provide configuration UI or web dashboard for managing settings.
  • Not designed for non-Rails frameworks as primary use case; integrations for Sinatra/Padrino are secondary.
  • Does not handle configuration schema generation or introspection for external tools.

🪤Traps & gotchas

  1. Environment matching: By default, config environment mirrors Rails.env—if you set a custom environment, it won't auto-load corresponding YAML files. 2. ERB in YAML: ERB is evaluated at load time with whatever context is available—avoid referencing undefined variables. 3. YAML inheritance: Settings files can inherit from base settings.yml, but the merge order (see yaml_source.rb) matters; later values override earlier ones. 4. Local files ignored: settings.local.yml is gitignored by default (see .gitignore)—useful for dev secrets, but teammates must create their own copy. 5. Nested access returns OpenStruct: Accessing Settings.foo returns an OpenStruct-like object, not a Hash—some methods may not work as expected.

🏗️Architecture

💡Concepts to learn

  • Rails Railtie — Config uses a Railtie (lib/config/integrations/rails/railtie.rb) to auto-initialize settings at Rails boot—understanding Railtie hooks is essential to grasp how Config integrates with Rails
  • YAML Inheritance and Merging — Config settings can inherit from base YAML files and merge environment-specific overrides; understanding the merge strategy (which values take precedence) is critical to debugging configuration issues
  • OpenStruct / Ostruct-like Behavior — Config returns objects that allow Settings.nested.property.access syntax via dynamic method_missing—understanding how this differs from Hash access is important for integration
  • ERB Templating in Configuration — YAML config files support embedded Ruby (ERB) for dynamic values—knowing when and how ERB is evaluated affects security and flexibility
  • Rack Middleware for Auto-reload — Config provides a Rack middleware (lib/config/rack/reloader.rb) to reload settings on file changes during development—understanding middleware ordering is important for correct behavior
  • Dry-rb Validation Schema — Config integrates dry-validation for runtime schema validation of settings—understanding how to define and apply schemas is essential for using validation features
  • Environment Namespacing in YAML — Config loads and merges environment-specific YAML files (settings/development.yml, settings/production.yml)—understanding how environment keys are resolved and merged is core to the gem's design
  • settingslogic/settingslogic — Earlier YAML-based config gem for Rails; Config is a modern maintained alternative with better framework support
  • colstrom/rubyconfig — Another config management gem—compare features and approach to understand tradeoffs
  • bkeepers/dotenv — Loads .env files into ENV; often used alongside Config for environment variable management
  • rails/rails — Config integrates with Rails via Railtie—understanding Rails initialization hooks is essential for this gem
  • dry-rb/dry-validation — Config uses dry-validation for schema validation (see dry_validation_requirements.rb)—dependency worth understanding

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive test coverage for lib/config/sources/env_source.rb

The env_source.rb file handles environment variable parsing but lacks dedicated integration tests. This is critical for a config management gem since ENV var handling is a primary feature. Adding tests would ensure edge cases (missing vars, type coercion, nested structures) are properly covered and prevent regressions.

  • [ ] Create spec/config/sources/env_source_spec.rb with tests for basic ENV var loading
  • [ ] Add tests for ENV var precedence over YAML sources
  • [ ] Test edge cases: empty values, special characters, numeric strings
  • [ ] Test integration with validation schema from lib/config/validation/schema.rb
  • [ ] Verify tests pass in CI via .github/workflows/tests.yml

Add dry_validation_requirements.rb integration documentation and spec coverage

The file lib/config/dry_validation_requirements.rb exists but there's no obvious spec file (dry_validation_requirements_spec.rb) in the spec directory. Since this appears to be a validation integration point, adding comprehensive tests would document the feature and ensure the dry-validation integration works correctly with the main Config class.

  • [ ] Create spec/config/dry_validation_requirements_spec.rb
  • [ ] Test validation rule definitions and error handling
  • [ ] Test integration between lib/config/validation/validate.rb and dry_validation_requirements.rb
  • [ ] Add example usage in spec showing how developers use dry-validation with Config
  • [ ] Verify integration with existing validation tests in spec/config/validation/

Add integration tests for Sinatra support in lib/config/integrations/sinatra.rb

The repo tests Rails integration extensively (spec/app/rails_5.2/) but Sinatra support lacks dedicated integration tests. This is a gap given that Sinatra is explicitly mentioned in README as a supported framework. Adding a spec/app/sinatra_app/ with integration tests would ensure the Sinatra railtie works correctly.

  • [ ] Create spec/app/sinatra_app/ directory with a minimal Sinatra test application
  • [ ] Create spec/integrations/sinatra_spec.rb to test Config loading in Sinatra context
  • [ ] Test that Settings are properly loaded from config/settings files in Sinatra
  • [ ] Test Sinatra-specific initialization via lib/config/integrations/sinatra.rb
  • [ ] Optionally add Sinatra app to .github/workflows/tests.yml test matrix

🌿Good first issues

  • Add specs for lib/config/sources/env_source.rb to test loading settings from environment variables—currently the file exists but test coverage may be sparse.
  • Document ERB templating examples in README.md with real-world use cases (e.g., interpolating Rails.root, ENV vars, or computed values in YAML).
  • Expand lib/config/rack/reloader.rb tests to cover auto-reload behavior across different Rack middleware stacks and middleware ordering edge cases.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 68f492b — Add rails 8.1 support (#385) (Nuzair46)
  • ce336f5 — Added Ruby 4.0 to test matrix (#384) (Nuzair46)
  • 5e192a5 — fix(security): resolve CodeQL warnings (#380) (Nuzair46)
  • 8b6ffe6 — release: 5.6.1 (pkuczynski)
  • d639f9d — ci: limit workflow permissions (#379) (pkuczynski)
  • e0bf18f — fix(security): replace IO.read with File.read (#378) (pkuczynski)
  • 263e66a — test: bump puma in rails 5.2 test app to fix security warning (#377) (pkuczynski)
  • c833d19 — release: 5.6.0 (pkuczynski)
  • 4dc0f3e — ci: fix jruby rails >= 7.2 (#376) (Nuzair46)
  • 1f17cd8 — feat: added extra sources in initializer (#366) (Nuzair46)

🔒Security observations

The rubyconfig/config gem is a configuration management library with moderate security posture. Primary concerns relate to YAML deserialization safety, ERB template injection risks, and environment variable handling. The codebase includes validation framework support which is positive. No critical vulnerabilities were identified, but best practices should be verified in actual implementation, particularly around YAML.safe_load() usage and ERB template processing. The gem itself appears well-structured with separation of concerns (sources, validation, integrations). Recommendation: Review YAML loading mechanism and ERB processing code, ensure comprehensive documentation of security considerations, and validate that sensitive data is never logged or exposed through configuration mechanisms.

  • Medium · YAML Deserialization Risk — lib/config/sources/yaml_source.rb. The codebase loads YAML configuration files (lib/config/sources/yaml_source.rb). If YAML files are loaded using unsafe methods like YAML.load() instead of YAML.safe_load(), it could allow arbitrary code execution through deserialized objects. YAML files in config/ directories should be treated as trusted input, but the implementation should be verified. Fix: Ensure YAML.safe_load() is used for parsing configuration files. Verify that no user-supplied YAML is processed with unsafe deserialization methods. Consider validating YAML structure before deserialization.
  • Medium · Environment Variable Injection — lib/config/sources/env_source.rb. The codebase includes lib/config/sources/env_source.rb which processes environment variables. Environment variables could be manipulated in certain deployment contexts. If environment variables are directly interpolated into configuration without validation, it could lead to injection attacks. Fix: Validate and sanitize environment variables before using them in configuration. Implement strict type checking and allowlisting for critical configuration values. Document which environment variables are expected and their allowed formats.
  • Medium · ERB Template Injection Risk — lib/config/sources/yaml_source.rb (likely ERB processing location). The README indicates that 'config files support ERB'. If ERB templates in configuration files process untrusted input or allow dynamic code execution, this could lead to server-side template injection (SSTI) vulnerabilities. Fix: If ERB is used in config files, ensure it only processes trusted configuration data. Avoid evaluating ERB templates that contain user-supplied input. Consider using safer templating alternatives or explicitly document security constraints for ERB usage.
  • Low · Missing Security Headers Configuration — lib/config/rack/reloader.rb. The Rack middleware (lib/config/rack/reloader.rb) handles request reloading but there is no evidence of security header configuration in the gem itself. While not the gem's responsibility, applications using this gem may lack security headers. Fix: Document best practices for security headers in the README. Recommend users implement security headers (CSP, X-Frame-Options, etc.) in their Rails/Sinatra applications using additional gems or middleware.
  • Low · No Input Validation Framework Enforcement — lib/config/validation/, lib/config/dry_validation_requirements.rb. While lib/config/validation/ and lib/config/dry_validation_requirements.rb exist for validation, the gem appears to provide optional validation. If applications skip validation, invalid or malicious configuration could be loaded. Fix: Encourage mandatory schema validation in documentation. Provide clear examples of validation setup. Consider making basic validation mandatory by default rather than optional.
  • Low · Heroku Integration Information Disclosure — lib/config/integrations/heroku.rb, lib/config/tasks/heroku.rake. The gem includes Heroku integration (lib/config/integrations/heroku.rb, lib/config/tasks/heroku.rake). Integration with external services could potentially expose configuration details if not properly secured. Fix: Ensure sensitive credentials are never logged or displayed in console output. Use environment variables for authentication with external services. Document secure setup procedures for Heroku integration.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Mixed signals · rubyconfig/config — RepoPilot