Open IanKemp opened 3 years ago
Bump.
@IanKemp thanks for opening this issue! Local host does no support appsettings.json. We have added this to the backlog but at this time this issue is not of the highest priority. We will keep this issue open and monitor to see if it gains traction from users.
Good to know, it tooks hours to understand why.
Strangely, I'm able to have information from AppSettings using IOptions
I hope, this will be fix one day, it's useful, and there will be consistency with web api and azure web job, which give the job easier for dev :)
I have local.settings.json with the following defined:
The reasons are:
because it is explicitly unsupported by the
local.settings.json
schema and apparently the host, as this causes host startup to fail withCan't determine project language from files
andMissing value for AzureWebJobsStorage in local.settings.json
.However if I use the first snippet (with
StorageQueue__ConnectionString
), the queue trigger that I have bound via the following:causes the host to fail on startup with:
The same happens if I change my queue trigger to:
At the end of the day, therefore, the only combination that works is using : as the hierarchy separator. But that does not take into account non-Windows systems, to my mind. Yes, I know we could update our deployment process to substitute __ for : when pushing to Azure, but I would rather avoid touching said process as far as possible.
The most obvious solution would be to use
appsettings.json
as well aslocal.settings.json
because the former isn't subject to the completely arbitrary limits of the latter's schema, which (I assume) would allow me to use proper hierarchical config without caring about separators - but #122 says that using both together is no longer supported... but https://github.com/Azure/azure-functions-host/issues/4761 says it is.But when I try to use
appsettings.json
by overridingFunctionsStartup.ConfigureAppConfiguration
(as per https://github.com/Azure/azure-functions-dotnet-extensions/pull/33), the host behaves as if the file doesn't exist - I get the sameWarning: Cannot find value named 'StorageQueue__ConnectionString' in local.settings.json that matches 'connection' property set on 'queueTrigger'
message as above. (Yes, I have ensured the file is copied to the output dir on build.)Basically, it's a very tangled mess and I'm trying to get some clear guidance here. Please can you advise:
func.exe
) properly supportappsettings.json
?local.settings.json
at all when I could just useappsettings.json
? Can I simply pretend that thelocal.settings.json
that's generated on project creation does not exist, and add all my nested configuration hierarchies inappsettings.json
instead?