Base solution for your next web application
Open Closed

Modules and appsettings Best Practice #12222


User avatar
0
[email protected] created

Trying to create a new module and trying to figure out the best practice for configuring the module from appsettings values.

I have read this link. https://aspnetboilerplate.com/Pages/Documents/Startup-Configuration. I have setup my module like that but can't figure out where to initialize the configuration values. Should I put my dependson in the core module? If so, I don't have the appsettings there.
Should I put the dependson in the webcore module? The problem is the order is off since the PreInitialize of my custom module gets called first. Or finally, should the dependson go in the webhost module?

This custom module is to introduce Elasticsearch into the project. I will need to fire a create index on startup so I need the configuration values.

Thanks


1 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @[email protected],

    You can get the configuration values ​​from the appsettings webhost by putting a dependon there.

    [DependsOn( typeof(MyAppHostModule), typeof(MyCustomHostModule) )]