All Projects → edvorg → Configuron

edvorg / Configuron

Licence: epl-1.0
Clojure(Script) config that reloads from project.clj when in dev mode

Programming Languages

clojure
4091 projects
clojurescript
191 projects

Projects that are alternatives of or similar to Configuron

V2ray Step By Step
This repo is a fork of ToutyRater/v2ray-guide, we aim to provide a new step-by-step guide of v2ray
Stars: ✭ 341 (+1320.83%)
Mutual labels:  config, configuration
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+3712.5%)
Mutual labels:  config, configuration
Centraldogma
Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
Stars: ✭ 378 (+1475%)
Mutual labels:  config, configuration
goconfig
.gitconfig syntax parser
Stars: ✭ 15 (-37.5%)
Mutual labels:  config, configuration
Xxl Conf
A lightweight distributed configuration management platform. (分布式配置管理平台XXL-CONF)
Stars: ✭ 619 (+2479.17%)
Mutual labels:  config, configuration
Hoplite
A boilerplate-free library for loading configuration files as data classes in Kotlin
Stars: ✭ 322 (+1241.67%)
Mutual labels:  config, configuration
Easy Wg Quick
Creates Wireguard configuration for hub and peers with ease
Stars: ✭ 502 (+1991.67%)
Mutual labels:  config, configuration
environment
🌳 Environment variable configuration for Node.js made easy.
Stars: ✭ 12 (-50%)
Mutual labels:  config, configuration
Konfig
Composable, observable and performant config handling for Go for the distributed processing era
Stars: ✭ 597 (+2387.5%)
Mutual labels:  config, configuration
Go Config
A dynamic config framework
Stars: ✭ 595 (+2379.17%)
Mutual labels:  config, configuration
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+3062.5%)
Mutual labels:  config, configuration
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+3383.33%)
Mutual labels:  config, configuration
Charles-Proxy-Mobile-Guide
The mobile hackers' guide to Charles Proxy 👍
Stars: ✭ 105 (+337.5%)
Mutual labels:  config, configuration
Config
The Config component helps you find, load, combine, autofill and validate configuration values of any kind, whatever their source may be (YAML, XML, INI files, or for instance a database).
Stars: ✭ 3,671 (+15195.83%)
Mutual labels:  config, configuration
nest-typed-config
Intuitive, type-safe configuration module for Nest framework ✨
Stars: ✭ 47 (+95.83%)
Mutual labels:  config, configuration
Koanf
Light weight, extensible configuration management library for Go. Built in support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
Stars: ✭ 450 (+1775%)
Mutual labels:  config, configuration
env
A lightweight package for loading OS environment variables into structs for Go projects
Stars: ✭ 24 (+0%)
Mutual labels:  config, configuration
eRCaGuy dotfiles
.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
Stars: ✭ 84 (+250%)
Mutual labels:  config, configuration
Jsonnet
Jsonnet - The data templating language
Stars: ✭ 5,257 (+21804.17%)
Mutual labels:  config, configuration
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+2579.17%)
Mutual labels:  config, configuration

configuron

Clojure(Script) environ compatible config that reloads from project.clj when in dev mode.

Clojars Project

Why

configuron is a configuration library that has interface of environ, but provides additional features.

  • easy to migrate from environ
  • env variable is updated every time you update your project.clj
  • clojurescript support. you can access your config on frontend the same way you do it on backend.
  • server-side rendering ready design. let's you choose whether you want to get config using ajax or encode it in html page.
  • filtering rules for client side config in order to limit information, that's available to the client.

Usage

Clojure

  1. Add :mode keys for each of your profiles in project.clj
{:profiles {:dev {:env {:mode :dev}}
            :uberjar {:env {:mode :prod}}}}
  1. Access your config through rocks.clj.configuron.core/env instead of environ.core/env.

ClojureScript

You can use your config on client-side as well. Simply add GET route /environ to your project with handler rocks.clj.configuron.core/config-handler:

(GET "/environ" [] #'config-handler)

By default your client-side config will be empty. To add some data you should add paths to :client-config-keys. For example given your profiles look like this.

{:profiles {:dev {:env {:mode :dev
                        :debug-info {:tokens {:sentry ""}}
                        :client-config-keys [[:mode]
                                             [:debug-info :tokens]]}}
            :uberjar {:env {:mode :uberjar
                            :client-config-keys [[:mode]]}}}}

/environ ring handler will return.

In dev:

{:mode :dev
 :debug-info {:tokens {:sentry ""}}}

In prod:

{:mode :uberjar}

You can access your config on client side as usual through rocks.clj.configuron.core/env or dynamically by executing http request to /environ.

Caution

When accessing rocks.clj.configuron.core/env on page load (for example cljs app entry point), there is no guarantee that config has been received by that time. There are two solutions for that.

  1. Wrap your code in go block
(go
  (let [env (<! (rocks.clj.configuron.core/get-env))]
    ;; your web-app initialization goes here
    ))

or (preferably)

  1. Write your config into dom on server side. This will also effectively avoid http request to /environ.

Example in html:

<body>
  <div id="config" transit="your config goes here" />
</body>

Example in hiccup:

[:body
 [:div#config {:transit (rocks.clj.configuron.core/get-client-config)}]]

License

Copyright © 2018 Eduard Knyshov

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].