{"action":"created","issue":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/5871","labels_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/5871/labels{/name}","comments_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/5871/comments","events_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/5871/events","html_url":"https://github.com/OrchardCMS/Orchard/issues/5871","id":108864054,"number":5871,"title":"Feature Request: Custom module settings in a module.config file","user":{"login":"dcinzona","id":52411,"avatar_url":"https://avatars.githubusercontent.com/u/52411?v=3","gravatar_id":"","url":"https://api.github.com/users/dcinzona","html_url":"https://github.com/dcinzona","followers_url":"https://api.github.com/users/dcinzona/followers","following_url":"https://api.github.com/users/dcinzona/following{/other_user}","gists_url":"https://api.github.com/users/dcinzona/gists{/gist_id}","starred_url":"https://api.github.com/users/dcinzona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcinzona/subscriptions","organizations_url":"https://api.github.com/users/dcinzona/orgs","repos_url":"https://api.github.com/users/dcinzona/repos","events_url":"https://api.github.com/users/dcinzona/events{/privacy}","received_events_url":"https://api.github.com/users/dcinzona/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-29T13:00:48Z","updated_at":"2015-09-29T16:00:06Z","closed_at":null,"body":"Instead of storing custom module settings in the root web.config, it would be nice to support custom settings within the module.  This would allow for updating settings without restarting the web application.  Adding a module.config file that allows for transforms for deploying to different environments could be one possible solution.  Then we would create a new interface that could read from the module.config much like App Settings.  Theoretically, I don't see any reason why we couldn't use web.config within the module root folder.  This gives us the benefit of intellisense within VS when editing the configuration, but it also enforces that schema.\r\n\r\nThe reason I bring this up is that I've seen first hand and through questions in Gitter, where devs want to store custom settings within a module, and while this is possible, retrieving those settings requires some boiler plate code.  It would be nice if this was built in as a feature.\r\n\r\nOne example could be if a module needs to talk to a different database, the DB connection string could be in module.config and retrieved via `IModuleConfig.GetSetting(\"myConnString\")`.  You could also extend this to allow for pulling settings from other modules: `IModuleConfig[\"AnotherModule\"].GetSetting(\"someSetting\")`.\r\n\r\nRight now, we are forced to include this within one of our modules where we store module specific configuration settings:\r\n\r\n```cs\r\n// Read the module Web.Config\r\nvar fileMap = new ExeConfigurationFileMap {\r\n  ExeConfigFilename = HostingEnvironment.MapPath(\"~/Modules/OurCustomModule/web.config\")\r\n};\r\n\r\nvar configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);\r\nvar appSettings = configuration.AppSettings.Settings;\r\n_baseApiUri = appSettings[\"BaseApiUri\"];\r\n...\r\n```\r\n\r\nThoughts?  \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/comments/144103212","html_url":"https://github.com/OrchardCMS/Orchard/issues/5871#issuecomment-144103212","issue_url":"https://api.github.com/repos/OrchardCMS/Orchard/issues/5871","id":144103212,"user":{"login":"dcinzona","id":52411,"avatar_url":"https://avatars.githubusercontent.com/u/52411?v=3","gravatar_id":"","url":"https://api.github.com/users/dcinzona","html_url":"https://github.com/dcinzona","followers_url":"https://api.github.com/users/dcinzona/followers","following_url":"https://api.github.com/users/dcinzona/following{/other_user}","gists_url":"https://api.github.com/users/dcinzona/gists{/gist_id}","starred_url":"https://api.github.com/users/dcinzona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcinzona/subscriptions","organizations_url":"https://api.github.com/users/dcinzona/orgs","repos_url":"https://api.github.com/users/dcinzona/repos","events_url":"https://api.github.com/users/dcinzona/events{/privacy}","received_events_url":"https://api.github.com/users/dcinzona/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T16:00:06Z","updated_at":"2015-09-29T16:00:06Z","body":"The only other way to do it without requiring app restarts is by creating settings in the admin UI, which is totally viable, but cumbersome\r\n"}}