When creating a new issue, please make sure the following information is part of your issue description. (if applicable). Thank You!
Which Akka.Net version you are using
1.3.4
On which platform you are using Akka.Net
MacOS using .NET Core 2
A list of steps to reproduce the issue. Or an gist or github repo which can be easily used to reproduce your case.
I got around this by manually loading the config using the ConfigurationFactory class, but the documentation states this should work automatically with an App.config file so it's worth creating an issue...
I just noticed that there is a load() function on the ConfigurationFactory class which says it will load the app.config or web.config files. I tried it but it did nothing - no config was loaded.
Also nothing is mentioned about this function in the doc at http://getakka.net/articles/concepts/configuration.html
I am currently setting up my projects in .net core as well and instead I've tried something like this if it helps.
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddXmlFile("myConfig.xml");
Configuration = builder.Build();
and then
ConfigurationFactory.ParseString(hoconConfig)
And then I've included the HOCON CDATA within the myConfig.xml
Yes. Dotnet core projects use a different kind of configuration system, then the normal .net framework. Using a seperate config file that contains your hocon and then using var cfg = ConfigurationFactory.ParseString(); and ActorSystem.Create("Server", cfg) to load your config into the actor system is the way to go.
We do have plans to streamline this for netcore projects. But right now, this is the way to do it.
@Danthar is there any progress done regarding loading the configuration in .net code?
Yes. Work is being done to put hocon in its own library and use that in the
akka.Net core codebase. Furthermore the new hocon package has
helper/loaders for the netcore infra. But I'm Not sure how far along it is.
I've been semi afk from the project dealing with personal stuff. But I
think @Arkatufus knows more.
Op di 18 jun. 2019 08:49 schreef Alberto Gregorio <[email protected]
:
@Danthar https://github.com/Danthar is there any progress done
regarding loading the configuration in .net code?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/akkadotnet/akka.net/issues/3323?email_source=notifications&email_token=AAHQ3F3N7O6YHSPI6CZKFDLP3CAQPA5CNFSM4EQK7ZIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX5LYLA#issuecomment-502971436,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAHQ3F2NDV3WL3NDEOPYUHTP3CAQPANCNFSM4EQK7ZIA
.
I am currently setting up my projects in .net core as well and instead I've tried something like this if it helps.
var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddXmlFile("myConfig.xml"); Configuration = builder.Build();and then
ConfigurationFactory.ParseString(hoconConfig)And then I've included the HOCON CDATA within the myConfig.xml
when i try to do this it gives me this error
ConfigurationBuiler does not contain a definition for SetBasePath im using the following namespaces :
using Microsoft.Extensions.Configuration;
System.IO;
Am I missing something , please help !
@revoltez Maybe this? https://stackoverflow.com/a/46843572/11421
ie:
The SetBasePath extension method is defined in Config.FileExtensions.
You need to add a reference to the Microsoft.Extensions.Configuration.FileExtensions package.
@revoltez Maybe this? https://stackoverflow.com/a/46843572/11421
ie:
The SetBasePath extension method is defined in Config.FileExtensions.
You need to add a reference to the Microsoft.Extensions.Configuration.FileExtensions package.
yes and also i had to add Microsoft.Extensions.Configuration.Xml package; it worked , but now i have a new problem , im new to akka.net and hocon and i dont understand @leo12chandu implementation, for example he is using Configuration as a variable whilst its a class and where is the implementation of hoconConfig ? , i would very much appreciate it if you can give me a more detailed implementation , and thank you sir for taking time to answer my question
@revoltez if you meant the code @leo12chandu wrote above - that is just standard .net code to read in xml settings, and then he included the hocon in as a string I guess.
you are using Configuration as a variable
He probably forgot to include IConfiguration configuration; somewhere above.
where is the implementation of hoconConfig
Another thing missing from the example, probably something like
var hoconConfig = Configuration["hocon"];
I went the more straight forward route personally:
var hoconObj = Akka.Configuration.ConfigurationFactory.ParseString(File.ReadAllText("app.conf"));
and then use hocon for all my configuration, but that will depend on what your project needs.
Most helpful comment
I am currently setting up my projects in .net core as well and instead I've tried something like this if it helps.
and then
ConfigurationFactory.ParseString(hoconConfig)And then I've included the HOCON CDATA within the myConfig.xml