{"id":15066755,"url":"https://github.com/jamesiarmes/configsl","last_synced_at":"2026-02-22T00:35:30.304Z","repository":{"id":255440947,"uuid":"851413165","full_name":"jamesiarmes/configsl","owner":"jamesiarmes","description":"A simple DSL for declarative configuration in ruby.","archived":false,"fork":false,"pushed_at":"2025-04-16T03:46:38.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T09:22:02.636Z","etag":null,"topics":["config","dsl","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/configsl","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesiarmes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-03T03:50:27.000Z","updated_at":"2024-09-15T04:10:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4e83402-60f4-4527-8bf2-81e9f45c07f9","html_url":"https://github.com/jamesiarmes/configsl","commit_stats":null,"previous_names":["jamesiarmes/configsl"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jamesiarmes/configsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesiarmes%2Fconfigsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesiarmes%2Fconfigsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesiarmes%2Fconfigsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesiarmes%2Fconfigsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesiarmes","download_url":"https://codeload.github.com/jamesiarmes/configsl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesiarmes%2Fconfigsl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29700599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T23:35:04.139Z","status":"ssl_error","status_checked_at":"2026-02-21T23:35:03.832Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","dsl","ruby"],"created_at":"2024-09-25T01:11:36.300Z","updated_at":"2026-02-22T00:35:30.279Z","avatar_url":"https://github.com/jamesiarmes.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConfigSL [![Gem Version](https://badge.fury.io/rb/configsl.svg)](https://badge.fury.io/rb/configsl) [![Coverage Status][badge-coverage]][coverage] [![Code Checks](https://github.com/jamesiarmes/configsl/actions/workflows/checks.yaml/badge.svg?branch=main)](https://github.com/jamesiarmes/configsl/actions/workflows/checks.yaml)\n\nConfigSL is a simple Domain-Specific Language (DSL) module for configuration.\nIt is designed to provide a declarative way to define configuration, with as few\ndependencies and additional cruft as possible. It is both modular and\nextensible, so you can use as little or as much as you need.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'configsl'\n```\n\nAnd then execute:\n\n```sh\nbundle install\n```\n\nOr install it yourself as:\n\n```sh\ngem install configsl\n```\n\n## Usage\n\nYou can start defining your configurations using two methods:\n\n1. Extend the included `ConfigSL::Config` base class\n2. Include the `ConfigSL` modules you want to use in you class\n\n### Using the included base class\n\nThe `ConfigSL::Config` base class includes common functionality for working with\nconfigurations. Currently, the class provides the following features:\n\n- **DSL**: The primary DSL for defining configuration options\n- **Format**: A simple way to enforce option value formatting\n- **FromEnvironment**: Load configuration from environment variables\n- **FromFile**: Load configuration from a file\n- **Validation**: Built-in validation for configuration options\n\n```ruby\nrequire 'configsl'\n\nclass AppConfig \u003c ConfigSL::Config\n    register_file_format :json\n    register_file_format :yaml\n\n    option :name, type: String, default: 'My App'\n    option :environment, type: Symbol, enum: %i[dev test prod], default: :dev,\n                         env_variable: 'RACK_ENV'\n    option :database, type: DatabaseConfig, required: true\nend\n```\n\n### Including modules\n\nIf you'd like to pick and choose the features you want to use, you can include\nmodules individually. _Most_ modules can be included in any order, but the `DSL`\nmodule _**must**_ be included before any others.\n\nAdditionally, you will need to implement `initialize` -- or some other method --\nthat sets the configuration values by calling `set_value` for each option.\n\n```ruby\nrequire 'configsl'\n\nclass ApplicationConfig\n    include ConfigSL::DSL\n    include ConfigSL::Format\n    include ConfigSL::FromEnvironment\n\n    option :name, type: String, default: 'My App'\n    option :environment, type: Symbol, env_variable: 'RACK_ENV'\n    option :database, type: DatabaseConfig\n\n    def initialize(params = {})\n      params.each do |name, value|\n        set_value(name, value)\n      end\n    end\nend\n```\n\n### A note about inheritance\n\nWhen working with multiple configuration classes, you'll likely want to use a\nbase class. This could be the `ConfigSL::Config` class, or a custom class that\nincludes the modules you need.\n\nWhile the modules you include are inherited by subclasses, any options you\ndefine via DSL are not. This is because these values are stored using _class\ninstance variables_. As a result, if you have options that are shared between\nclasses, they will need to be implemented in both.\n\nIt's important to note that this is not limited to your defined configuration\noptions, but also methods such as `register_file_format` and\n`config_file_path`.\n\n[badge-coverage]: https://coveralls.io/repos/github/jamesiarmes/configsl/badge.svg\n[coverage]: https://coveralls.io/github/jamesiarmes/configsl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesiarmes%2Fconfigsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesiarmes%2Fconfigsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesiarmes%2Fconfigsl/lists"}