-
Notifications
You must be signed in to change notification settings - Fork 16
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
added AddHoconFile
method
#58
Conversation
Allows Akka.Hosting to automatically load HOCON from a file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed my own changes
@@ -36,19 +36,6 @@ public SingletonActor(IMySingletonInterface singleton) | |||
}); | |||
} | |||
} | |||
|
|||
private static async Task<IHost> StartHost(Action<IServiceCollection> testSetup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to a separate TestHelpers
class so it can be re-used across multiple tests
var hocon = sys.Settings.Config; | ||
|
||
// assert | ||
hocon.HasPath("petabridge.cmd").Should().BeTrue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a custom HOCON section in the test.hocon
file that wouldn't normally appear in default HOCON - thus it demonstrates that the file is being correctly loaded into the ActorSystem
as a result of the AddHoconFile
method.
public static AkkaConfigurationBuilder AddHoconFile(this AkkaConfigurationBuilder builder, string hoconFilePath, | ||
HoconAddMode addMode = HoconAddMode.Append) | ||
{ | ||
var hoconText = ConfigurationFactory.ParseString(File.ReadAllText(hoconFilePath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parses the file synchronously - this will throw an exception if the file is not found, which is to be expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Allows Akka.Hosting to automatically load HOCON from a file. Solves a longtime painpoint for users where they typically had to call
ConfigurationFactory.ParseString(File.ReadAllText(filePath))
. Now it's a one-liner.Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):