milieu icon indicating copy to clipboard operation
milieu copied to clipboard

no way to have multiple configuration "scopes"

Open S11001001 opened this issue 12 years ago • 2 comments

The configuration tree, represented by configuration and value, is global; there is no way to have multiple clients of milieu operate under isolated configuration hierarchies, each with different semantics for the configuration tree.

Perhaps the intent here is that such subclients of the containing program, which is responsible for loading the amalgamated configuration, is responsible for injecting configuration into each library, via a reader monad or something less subtle, but the spirit of the value function seems to be that configuration needn't be injected.

Perhaps configuration and value could be defined automatically in each module or set of modules where users might want to declare a configuration scope.

S11001001 avatar Apr 11 '12 23:04 S11001001

This is an interesting idea and sounds like it could be a useful feature. I personally can't presently think of a use-case for it, but I'm going to leave this issue open so that if and when the need for it arises it can be implemented in a way that is informed in part by the use case.

rplevy-draker avatar Apr 13 '12 22:04 rplevy-draker

Given the new flexible source specification syntax (not yet released, currently on branch 1.0.0), I think it would make sense to add this feature using a :scope keyword.

  (config/load-config
    {:src "baz", :as :edn, :scope :my-scope}  ; <-- specially defined scope
    {:src "quux", :as :edn}) ; <-- normal default scope

And then in with-env

  (config/with-env :dev, :scope :my-scope  ; <-- use values for :dev from special scope
     ... )

  ...

  (config/with-env :dev  ; <-- use values for :dev from default scope
     ... )   

rplevy-draker avatar Feb 06 '13 20:02 rplevy-draker