{"id":13507665,"url":"https://github.com/KamilLelonek/figaro-elixir","last_synced_at":"2025-03-30T09:32:59.315Z","repository":{"id":35518857,"uuid":"39789271","full_name":"KamilLelonek/figaro-elixir","owner":"KamilLelonek","description":"Environmental variables manager based on Figaro for Elixir projects","archived":false,"fork":false,"pushed_at":"2016-10-19T15:25:54.000Z","size":19,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T05:23:35.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/KamilLelonek.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":"2015-07-27T17:52:52.000Z","updated_at":"2024-11-24T11:19:06.000Z","dependencies_parsed_at":"2022-09-03T17:01:08.305Z","dependency_job_id":null,"html_url":"https://github.com/KamilLelonek/figaro-elixir","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/KamilLelonek%2Ffigaro-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamilLelonek%2Ffigaro-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamilLelonek%2Ffigaro-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamilLelonek%2Ffigaro-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KamilLelonek","download_url":"https://codeload.github.com/KamilLelonek/figaro-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"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-01T02:00:37.561Z","updated_at":"2025-03-30T09:32:59.010Z","avatar_url":"https://github.com/KamilLelonek.png","language":"Elixir","funding_links":[],"categories":["Configuration"],"sub_categories":[],"readme":"# Figaro Elixir\n\n[![Build Status](https://travis-ci.org/KamilLelonek/figaro-elixir.svg)](https://travis-ci.org/KamilLelonek/figaro-elixir)\n\nThis project is based on [figaro gem](https://github.com/laserlemon/figaro) for Rails written by [Steve Richert](https://twitter.com/laserlemon).\n\nIt's was created to manage `ENV` configuration for `Elixir` applications.\n\n## How does it work?\n\nFigaro parses a git-ignored `YAML` file in your application and loads its values into environmental variables.\n\nThis is very handy for production environments when you don't want to store some of credentials in your repository.\n\n## Installation\n\nAdd Figaro Elixir as a dependency in your `mix.exs` file.\n\n```elixir\ndefp deps do\n  [\n    # ...\n    {:figaro_elixir, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\nYou should also update your applications list to include Figaro:\n\n```elixir\ndef application do\n  [\n     applications: [\n       # ...\n       :figaro_elixir\n     ]\n  ]\nend\n```\n\nOnce you've done that, run `mix deps.get` in your command line to fetch the dependency.\n\n## Usage\n\nThe basic requirement is to have `application.yml` file in your project `config` directory.\n\n`Figaro` will read it, parse it and use it to store environmental variables.\n\nPlease note that `ENV` is a simple key/value store with the following features:\n\n  - all values are converted to strings\n  - deeply nested configuration structures are not possible\n\n### Simple example\n\nYou can very easily start using `Figaro` for `Elixir`. Just create an appropriate file:\n\n\n```yaml\n# config/application.yml\n\nfoo: bar\nbaz: qux\n```\n\nAnd run `iex -S mix` in your terminal. You will have an access to configuration values via `FigaroElixir.env` or `System` environmental variables:\n\n```elixir\niex(1)\u003e FigaroElixir.env\n%{\"baz\" =\u003e \"qux\", \"foo\" =\u003e \"bar\"}\niex(2)\u003e FigaroElixir.env[\"baz\"]\n\"qux\"\niex(3)\u003e System.get_env(\"foo\")\nnil\niex(4)\u003e System.get_env(\"FOO\")\n\"bar\"\n```\n\n**Keep in mind that system environmental variables keys are uppercased.**\n\n### Environment-specific configuration\n\nThe power of `Figaro` elixir comes from distinguishing environments based on `Mix.env` property.\n\nYou may have a file defined like this:\n\n```elixir\na: a\nb: ~\n\ntest:\n  c: 1\n  d: ~\n```\n\nAnd then after running `MIX_ENV=test iex -S mix` you will see:\n\n```elixir\niex(1)\u003e FigaroElixir.env\n%{\"a\" =\u003e \"a\", \"b\" =\u003e \"~\", \"c\" =\u003e \"1\", \"d\" =\u003e \"~\"}\niex(2)\u003e FigaroElixir.env[\"c\"]\n\"1\"\niex(3)\u003e System.get_env(\"C\")\n\"1\"\n```\n\nThat's it. You don't have to do anything more.\n\n#### Caveats\n\nIf you are using [`escript`](http://elixir-lang.org/docs/master/mix/Mix.Tasks.Escript.Build.html) build tool, you need to have `:mix` among your `apps` in `mix.exs` file and copy `application.yml` file to your `rel/project_name/config` directory.\n\n## About the author\n\nMy name is Kamil Lelonek, I'm a full-stack developer and polyglot programmer. I love playing with different languages, technologies and tools. You can visit [my website](http://kamil.lelonek.me/) read [my blog](https://medium.com/@KamilLelonek) or follow me on [twitter](https://twitter.com/KamilLelonek). In case of any problems or suggestions do not hesitate and create a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKamilLelonek%2Ffigaro-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKamilLelonek%2Ffigaro-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKamilLelonek%2Ffigaro-elixir/lists"}