Skip to content

Question: Good practices for app config when using Aff/Eff #1206

Answered by louthy
benjstephenson asked this question in Q&A
Discussion options

You must be logged in to vote

Both option 1 and 2 are fine, it really depends how much config you have. Remember you can inherit traits (because they're just interfaces), so you can have:

    public interface HasAppConfig<RT> { ... }
    public interface HasServiceConfig<RT> { ... }
    public interface HasWebConfig<RT> { ... }

And then package them up with inheritance:

    public interface HasConfig<RT> : 
        HasAppConfig<RT>, 
        HasServiceConfig<RT>, 
        HasWebConfig<RT>
   {}

That means you can use HasConfig in general areas of the application, and Has* in more specific areas, like a service-subsystem.

The other thing to remember is to only expose configuration that's not related to the underlying i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@benjstephenson
Comment options

Answer selected by benjstephenson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1205 on March 13, 2023 12:19.