Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Stijn Opheide
    @stijnopheide
    hi all. just getting started with aero, I have a question wrt the integration with component/system
    how would you go about 'detecting' which sub-systems you need to start?
    we have an application that is configured and started as one big system in local development, but when deployed, some components are put into different JVM processes
    before aero we were just detecting an environment variable and dissocing everything from the system that was not needed before starting it
    but if aero comes into the mix, you could maybe only create components for which a config is available
    Malcolm Sparks
    @malcolmsparks
    (keys (aero/read-config ...))
    ?
    the aero config is just a map, post tag expansion which means you only see the config for your particular profile after you read it
    Stijn Opheide
    @stijnopheide
    yes, since component doesn't do any nesting, I think that would work
    I need to rework my config file significantly, but it's going to be better :)
    namespaced config values too, makes it harder to make mistakes
    Malcolm Sparks
    @malcolmsparks
    Stijn Opheide
    @stijnopheide
    yes, I'm working with that example now
    Malcolm Sparks
    @malcolmsparks
    Since we're talking about aero, there's yet another pattern we use with component for our juxt website - we keep the config (and quite a lot else) in a special component called 'app-state'. All components in our system that use/need state depend on that app-state component
    The nice thing about aero is that it is agnostic to how you use it - after all, Aero is Edn Really Ok?
    Stijn Opheide
    @stijnopheide
    :)
    Malcolm Sparks
    @malcolmsparks
    Well, under the hood it's just edn, but Gardner Vickers has put in some neat stuff - we have ^:ref metadata which I find very useful to avoid duplication - it's a poor-person's pull syntax
    Stijn Opheide
    @stijnopheide
    yes, I have seen that
    Stijn Opheide
    @stijnopheide
    hmmm, I'm not really getting there with just merging the config into the system.
    let's say you have a component :db, but you have several implementations of it: e.g. datomic, in-mem, whatever. somewhere in your config you have to specify the type of the db you'd like
    since component requires you to define concrete types through defrecord, there's really no way to create it based on the config file, unless you upfront ... erm while I'm typing, I think I might have a solution :)
    before constructing the system, do a pre-read of the config file to see which type of db you're going to need.
    and then merge in all the rest of the config
    Stijn Opheide
    @stijnopheide
    @malcolmsparks the pattern I'm using right now is: store both the system config and the depency map in an aero config file. This allows you to split your system into components when running in production
    Stijn Opheide
    @stijnopheide
    @malcolmsparks thanks for aero. the extensibility through reader tags is really nice!
    Malcolm Sparks
    @malcolmsparks
    I think EDN is great - and very under-appreciated by the Clojure community. I hope aero helps demonstrate an example of how powerful it can be
    matanster
    @matanster
    Silly question ― how do I use configuration after it is loaded? not sure I see an example in the github readme for that, or I've not read carefully
    Malcolm Sparks
    @malcolmsparks
    @matanster you end up with a normal Clojure map - which you can access in the normal ways, for example, clojure.core/get-in
    matanster
    @matanster
    @malcolmsparks thanks!