{"id":15968811,"url":"https://github.com/dmathieu/smart_config","last_synced_at":"2025-07-10T08:43:08.616Z","repository":{"id":224996593,"uuid":"763967325","full_name":"dmathieu/smart_config","owner":"dmathieu","description":"A DLS for reading and accessing static configuration","archived":false,"fork":false,"pushed_at":"2025-06-24T06:54:16.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-24T07:35:06.050Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dmathieu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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-02-27T08:39:04.000Z","updated_at":"2025-06-24T06:54:18.000Z","dependencies_parsed_at":"2024-03-25T15:14:01.077Z","dependency_job_id":"fb250738-57e6-4f21-bcca-2d1b20ad06b3","html_url":"https://github.com/dmathieu/smart_config","commit_stats":null,"previous_names":["dmathieu/smart_config"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dmathieu/smart_config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmathieu%2Fsmart_config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmathieu%2Fsmart_config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmathieu%2Fsmart_config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmathieu%2Fsmart_config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmathieu","download_url":"https://codeload.github.com/dmathieu/smart_config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmathieu%2Fsmart_config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264552175,"owners_count":23626652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-07T19:04:09.146Z","updated_at":"2025-07-10T08:43:08.559Z","avatar_url":"https://github.com/dmathieu.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Config\n\nWe have \"smart\" toothbrushes these days, so why not smart configuration?\n\n**Note**: As you can see in the version number, this gem is still in a very early version, and you should expect that there may be breaking changes until we reach 1.0.\n\n## Usage\n\nSmart Config allows you to define a static configuration and access it from anywhere within your application.\nIt will try to read the configuration from a YAML file, and fallback on environment variables.\n\n### Installation\n\nAdd the `smart_config` dependency to you Gemfile:\n\n```\ngem 'smart_config'\n```\n\n### Usage\n\nThen, create a new config class that, and define the configuration you need:\n\n```ruby\nclass Config\n\textend SmartConfig::Config\n\n\t# Optional. Will default to `config/config.yml`\n\tconfig_path 'config/app_config.yml'\n\n\tvalue :app_name, default: 'My App'\n\n\tgroup :smtp do\n\t\tvalue :hostname\n\t\tvalue :port, format: :integer\n\t\tvalue :username\n\t\tvalue :password\n\tend\n\n\tgroup :redis do\n\t\tgroup :connection do\n\t\t\tvalue :hostname\n\t\t\tvalue :port\n\t\t\tvalue :username\n\t\t\tvalue :password\n\t\tend\n\n\t\tvalue :timeout\n\tend\nend\n```\n\nThen, within your application, you can call:\n\n```\nConfig.redis.connection.hostname\n```\n\nTo access the configuration value, from the following YAML file for example:\n\n```yaml\nredis:\n  connection:\n    hostname: 'localhost'\n```\n\nFor values that are not  in the YAML config, the tool will try reading it from environment variables, such as (from the previous configuration):\n\n```\nREDIS_CONNECTION_PASSWORD\n```\n\n#### Value Options\n\nValues can use options, which can be set after the value name. For example:\n\n```ruby\nvalue :hostname, default: 'localhost'\n```\n\nAll available options are:\n\n| name      | description                                                                                                                                        |\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| default   | Sets a default value for the field, if no configuration could be found. If this option is not set, getting an unset field will raise an exception. |\n| format    | Sets the format of the field. If this option is not set, the field will be formatted as string.                                                    |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmathieu%2Fsmart_config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmathieu%2Fsmart_config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmathieu%2Fsmart_config/lists"}