{"id":13879491,"url":"https://github.com/socketry/variant","last_synced_at":"2025-04-22T16:32:54.486Z","repository":{"id":59159110,"uuid":"242438953","full_name":"socketry/variant","owner":"socketry","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-28T09:13:35.000Z","size":33,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T14:47:58.872Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socketry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-23T01:41:29.000Z","updated_at":"2023-12-04T23:37:10.000Z","dependencies_parsed_at":"2022-09-13T20:10:53.534Z","dependency_job_id":null,"html_url":"https://github.com/socketry/variant","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fvariant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fvariant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fvariant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fvariant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socketry","download_url":"https://codeload.github.com/socketry/variant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223900219,"owners_count":17222028,"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-08-06T08:02:22.710Z","updated_at":"2024-11-10T01:09:20.295Z","avatar_url":"https://github.com/socketry.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Variant\n\nProvides a model for application variants, including documenting behaviour like `RACK_ENV` and `APP_ENV`.\n\n[![Development](https://github.com/socketry/variant/workflows/Development/badge.svg?branch=master)](https://github.com/socketry/variant/actions?workflow=Development)\n\n## Installation\n\n```\nbundle add variant\n```\n\n## Usage\n\nVariants are used to indicate the default configuration for an application. There are four suggested variants:\n\n| Variant     | Data                                | Usage                                  |\n|-------------|-------------------------------------|----------------------------------------|\n| Production  | Persistent, real data \u0026 interfaces. | Instance/cluster.                      |\n| Staging     | Duplicate/subset of production.     | Instance/cluster.                      |\n| Development | Fixtures, sample data.              | Local machine. **Default** variant.    |\n| Testing     | Fixtures, mocked interfaces.        | Local machine, continuous integration. |\n\n### Environment Variables\n\nThe general mechanism for specifying a variant is on the command line before running the application:\n\n```\nVARIANT=production falcon serve\n```\n\nIn your code, you access this like so:\n\n```ruby\nVariant.default # =\u003e :production\nVariant.for(:database) # =\u003e :production\n```\n\n### System-specific Variants\n\nYou can specify system-specific variants. These are useful when you have e.g. 2 different database clusters, or you want to run a development instance connected to a production database.\n\n```\nVARIANT=production DATABASE_VARIANT=production-aws\n```\n\nIn your code, you access this like so:\n\n```ruby\nVariant.default # =\u003e :production\nVariant.for(:database) # =\u003e :'production-aws'\n```\n\nIf you don't specify a system-specific variant, it will be the same as the default variant.\n\n### Bake Integration\n\nThis gem provides [bake](https://github.com/socketry/bake) recipes for setting the variants as outlined above.\n\n```\nbake variant:production ...\nbake variant:staging ...\nbake variant:development ...\nbake variant:testing ...\n```\n\nIn addition, the tasks also support specifying overrides:\n\n```\n% bake variant:development database=production variant:show\n0.01s     info: Environment [pid=417910] [2020-02-29 11:43:25 +1300]\n              | {\"VARIANT\"=\u003e\"development\", \"DATABASE_VARIANT\"=\u003e\"production\"}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nReleased under the MIT license.\n\nCopyright, 2020, by [Samuel G. D. Williams](https://www.codeotaku.com).\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketry%2Fvariant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketry%2Fvariant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketry%2Fvariant/lists"}