Skip to content

Add mechanisms for loading "default HOCON" in both .NET Framework and .NET Core #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Aaronontheweb opened this issue Dec 20, 2019 · 3 comments · Fixed by #152
Closed
Assignees
Milestone

Comments

@Aaronontheweb
Copy link
Member

In part to help cleanly decouple HOCON from Akka.NET, one major sticky wicket that needs to be addressed is Akka.NET's usage of the legacy System.ConfigurationManager APIs that are depended on by nearly all of our .NET Framework users (see akkadotnet/akka.net#3944 (comment))

What I would like to implement is a static helper method for loading the "default" HOCON file, if there is one to be found.

The options for the "default" files are, in the following loading order:

  1. [.NET Core / .NET Framework] An "app.conf" or an "app.hocon" file in the current working directory of the executable when it loads;
  2. [.NET Framework] - the <hocon> ConfigurationSection inside App.config or Web.config, which should also resolve rename AkkaConfigurationSection to HoconConfigurationSection? #8 and Remove top level <akka> element #9
  3. [.NET Framework] - and a legacy option, to load the old <akka> HOCON section for backwards compatibility purposes with all users who are running a version of Akka.NET older than 1.4.0.

The default HOCON will be loaded by an ActorSystem automatically in Akka.NET, if no other HOCON value is supplied during the ActorSystem.Create method, via the following call which will be implemented in the HOCON.Configuration library:

ConfigurationFactory.LoadDefaultHocon();

Most of the hard work for this has already been done by @Arkatufus - I'm going to work on implementing a few helper methods and some backwards compatibility shims for making this fully supported inside Akka.NET.

@Aaronontheweb Aaronontheweb added this to the HOCON v1.2.1 milestone Dec 20, 2019
@Aaronontheweb Aaronontheweb self-assigned this Dec 20, 2019
@Aaronontheweb
Copy link
Member Author

Already have this method:

public static Config Load()
{
return Load("akka");
}

I'll use that instead.

@Aaronontheweb
Copy link
Member Author

And look at this, we have this one too:

public static Config Default()
{
return FromResource("Default.conf");
}

@Aaronontheweb
Copy link
Member Author

Alrighty... That's what I'll target.

Aaronontheweb added a commit to Aaronontheweb/HOCON that referenced this issue Dec 20, 2019
Added ConfigurationFactory.FromFile method
Added new HOCON loading order per 151
Made ConfigurationFactory.Load Obsolete
Aaronontheweb added a commit that referenced this issue Dec 27, 2019
* working on adding default HOCON loading methods (#151)

Added ConfigurationFactory.FromFile method
Added new HOCON loading order per 151
Made ConfigurationFactory.Load Obsolete

* added specs

* cleaned up Default() method

* added default HOCON reading instructions to README
Aaronontheweb added a commit that referenced this issue Dec 27, 2019
* working on adding default HOCON loading methods (#151)

Added ConfigurationFactory.FromFile method
Added new HOCON loading order per 151
Made ConfigurationFactory.Load Obsolete

* added specs

* cleaned up Default() method

* added default HOCON reading instructions to README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant