{"id":13591444,"url":"https://github.com/weavejester/environ","last_synced_at":"2025-10-05T11:27:39.495Z","repository":{"id":2920045,"uuid":"3930288","full_name":"weavejester/environ","owner":"weavejester","description":"Library for managing environment variables in Clojure","archived":false,"fork":false,"pushed_at":"2024-04-15T15:28:54.000Z","size":67,"stargazers_count":932,"open_issues_count":19,"forks_count":71,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-09-20T08:43:13.520Z","etag":null,"topics":["clojure","environment-variables"],"latest_commit_sha":null,"homepage":"","language":"Clojure","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/weavejester.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2012-04-04T15:43:51.000Z","updated_at":"2025-08-26T06:30:19.000Z","dependencies_parsed_at":"2024-06-18T12:36:57.246Z","dependency_job_id":"dd495168-bff1-4ce1-a04c-068681eae7c8","html_url":"https://github.com/weavejester/environ","commit_stats":{"total_commits":76,"total_committers":17,"mean_commits":4.470588235294118,"dds":"0.23684210526315785","last_synced_commit":"aa90997b38bb8070d94dc4a00a14e656eb5fc9ae"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/weavejester/environ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fenviron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fenviron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fenviron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fenviron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weavejester","download_url":"https://codeload.github.com/weavejester/environ/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fenviron/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276689016,"owners_count":25686611,"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","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["clojure","environment-variables"],"created_at":"2024-08-01T16:00:57.615Z","updated_at":"2025-10-05T11:27:39.429Z","avatar_url":"https://github.com/weavejester.png","language":"Clojure","funding_links":[],"categories":["Clojure","config"],"sub_categories":[],"readme":"# Environ\n\nEnviron is a Clojure library for managing environment settings from a\nnumber of different sources. It works well for applications following\nthe [12 Factor App](http://12factor.net/) pattern.\n\nCurrently, Environ supports four sources, resolved in the following\norder:\n\n1. A `.lein-env` file in the project directory\n2. A `.boot-env` file on the classpath\n3. Environment variables\n4. Java system properties\n\nThe first two sources are set by the lein-environ and boot-environ\nplugins respectively, and should not be edited manually.\n\nThe `.lein-env` file is populated with the content of the `:env` key\nin the Leiningen project map. The `.boot-env` file is populated by the\n`environ.boot/environ` Boot task.\n\n\n## Installation\n\nInclude the following dependency in your `project.clj` file:\n\n```clojure\n:dependencies [[environ \"1.2.0\"]]\n```\n\nIf you want to be able to draw settings from the Leiningen project\nmap, you'll also need the following plugin:\n\n```clojure\n:plugins [[lein-environ \"1.2.0\"]]\n```\n\nIf you are using the Boot toolchain, you may want to read and write\nsettings from build pipelines. In *build.boot*, add the dependency:\n\n```clojure\n:dependencies '[[boot-environ \"1.2.0\"]]\n```\n\nThen require the environ boot task.\n\n```clojure\n(require '[environ.boot :refer [environ]])\n```\n\n\n## Usage\n\nLet's say you have an application that requires a database connection.\nOften you'll need three different databases, one for development, one\nfor testing, and one for production.\n\nLets pull the database connection details from the key `:database-url`\non the `environ.core/env` map.\n\n```clojure\n(require '[environ.core :refer [env]])\n\n(def database-url\n  (env :database-url))\n```\n\nThe value of this key can be set in several different ways. The most\ncommon way during development is to use a local `profiles.clj` file in\nyour project directory. This file contains a map with profiles that will\nbe merged with the profiles specified in the standard `project.clj`, but\ncan be kept out of version control and reserved for local development options.\n\n```clojure\n{:dev  {:env {:database-url \"jdbc:postgresql://localhost/dev\"}}\n :test {:env {:database-url \"jdbc:postgresql://localhost/test\"}}}\n```\n\nIn this case we add a database URL for the dev and test environments.\nThis means that if you run `lein repl`, the dev database will be used,\nand if you run `lein test`, the test database will be used.\n\nSo that profiles you define in `profiles.clj` are merged into, rather than\nreplacing profiles defined in `project.clj`, a composite profile can be\ncreated in `project.clj`:\n\n```clojure\n:profiles {:dev [:project/dev :profiles/dev]\n           :test [:project/test :profiles/test]\n           ;; only edit :profiles/* in profiles.clj\n           :profiles/dev  {}\n           :profiles/test {}\n           :project/dev {:source-paths [\"src\" \"tool-src\"]\n                         :dependencies [[midje \"1.6.3\"]]\n                         :plugins [[lein-auto \"0.1.3\"]]}\n           :project/test {}}\n```\n\nAnd then use the `:profiles/dev` key in your `profiles.clj`.\n\nKeywords with a `project` namespace are looked up in the project\nmap. For example:\n\n```clojure\n{:env {:app-version :project/version}}\n```\n\nThis looks up the `:version` key in the Leiningen project map. You can\nview the full project map by using [lein-pprint][].\n\nIn the case of Boot, you have the full flexibility of tasks and build\npipelines, meaning that all the following are valid:\n\n```clojure\n$ boot environ -e database-url=jdbc:postgresql://localhost/dev repl\n```\n\n```clojure\n(environ :env {:database-url \"jdbc:postgresql://localhost/dev\"})\n```\n\nThe latter form can be included in custom pipelines and `task-options!'.\n\nThe task also creates or updates a `.boot-env` file in the fileset.\nThis is useful for tasks that create their own pods like\n[boot-test][], which won't see changes in the environ vars.\n\nWhen you deploy to a production environment, you can make use of\nenvironment variables, like so:\n\n```bash\nDATABASE_URL=jdbc:postgresql://localhost/prod java -jar standalone.jar\n```\n\nOr use Java system properties:\n\n```bash\njava -Ddatabase.url=jdbc:postgresql://localhost/prod -jar standalone.jar\n```\n\nNote that Environ automatically lowercases keys, and replaces the\ncharacters \"_\" and \".\" with \"-\". The environment variable\n`DATABASE_URL` and the system property `database.url` are therefore\nboth converted to the same keyword `:database-url`.\n\n[lein-pprint]: https://github.com/technomancy/leiningen/tree/master/lein-pprint\n[boot-test]:   https://github.com/adzerk-oss/boot-test\n\n*Important* -- environ will not pick up configuration settings from the \n`project.clj` when called from a compiled uberjar. So for any compiled \ncode you produce with `lein uberjar`, you will want to set your \nconfiguration values via shell environment and/or system properties.\n\n## License\n\nCopyright © 2020 James Reeves\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Fenviron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweavejester%2Fenviron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Fenviron/lists"}