Merge remote-tracking branch 'origin/main' into develop

This commit is contained in:
Mike Bierlee 2022-11-27 21:47:55 +03:00
commit c2b792d9a1

View file

@ -4,7 +4,7 @@ Version 1.0.0
Copyright 2022 Mike Bierlee Copyright 2022 Mike Bierlee
Licensed under the terms of the MIT license - See [LICENSE.txt](LICENSE.txt) Licensed under the terms of the MIT license - See [LICENSE.txt](LICENSE.txt)
[![DUB Package](https://img.shields.io/dub/v/mirage-config.svg)](https://code.dlang.org/packages/mirage-config) [![DUB Package](https://img.shields.io/dub/v/mirage-config.svg)](https://code.dlang.org/packages/mirage-config)
Toolkit for loading and using application configuration from various formats for the D programming language. Toolkit for loading and using application configuration from various formats for the D programming language.
@ -16,10 +16,13 @@ Features:
- Parse configuration from string, JSONValue or from disk. - Parse configuration from string, JSONValue or from disk.
## Getting started ## Getting started
### DUB Dependency ### DUB Dependency
See the [DUB project page](https://code.dlang.org/packages/mirage-config) for instructions on how to include Mirage Config into your project. See the [DUB project page](https://code.dlang.org/packages/mirage-config) for instructions on how to include Mirage Config into your project.
### Quickstart ### Quickstart
```d ```d
import std.stdio : writeln; import std.stdio : writeln;
import mirage : loadConfig, parseJavaProperties; import mirage : loadConfig, parseJavaProperties;
@ -51,31 +54,38 @@ More formats are available (see [Formats](#formats).)
For more details and examples, see the [examples](examples) directory. For more details and examples, see the [examples](examples) directory.
## Formats ## Formats
The following file formats are currently supported: The following file formats are currently supported:
| Format | Extension | Import<sup>*</sup> | Loader | Parser | Factory | | Format | Extension | Import<sup>\*</sup> | Loader | Parser | Factory |
|-------------|-------------|--------------------|---------------------------|---------------------------------|-------------------------| | ----------- | ----------- | ------------------- | --------------------------- | ---------------------------------- | ----------------------- |
| _any below_ | _any below_ | `mirage` | `loadConfig`<sup>**</sup> | _(N/A)_ | | | _any below_ | _any below_ | `mirage` | `loadConfig`<sup>\*\*</sup> | _(N/A)_ | |
| INI | .ini | `mirage.ini` | `loadIniConfig` | `parseIniConfig` | `IniConfigFactory` | | INI | .ini | `mirage.ini` | `loadIniConfig` | `parseIniConfig` | `IniConfigFactory` |
| Java | .properties | `mirage.java` | `loadJavaProperties` | `parseJavaProperties` | `JavaPropertiesFactory` | | Java | .properties | `mirage.java` | `loadJavaProperties` | `parseJavaProperties` | `JavaPropertiesFactory` |
| JSON | .json | `mirage.json` | `loadJsonConfig` | `parseJsonConfig`<sup>***</sup> | `JsonConfigFactory` | | JSON | .json | `mirage.json` | `loadJsonConfig` | `parseJsonConfig`<sup>\*\*\*</sup> | `JsonConfigFactory` |
<sup>\*</sup> _Any loader or parser can be imported from the `mirage` package since they are all publicly imported._ <sup>\*</sup> _Any loader or parser can be imported from the `mirage` package since they are all publicly imported._
<sup>\*\*</sup> _Loads files based on their extension. If the file does not use one of the extensions in the table, you must use a specific loader._ <sup>\*\*</sup> _Loads files based on their extension. If the file does not use one of the extensions in the table, you must use a specific loader._
<sup>\*\*\*</sup> _Besides parsing strings like the other formats, it also accepts a `JSONValue`._ <sup>\*\*\*</sup> _Besides parsing strings like the other formats, it also accepts a `JSONValue`._
Documentation ## Documentation
-------------
You can generate documentation from the source code using DUB: You can generate documentation from the source code using DUB:
``` ```
dub build --build=ddox dub build --build=ddox
``` ```
The documentation can then be found in docs/ The documentation can then be found in docs/
## History ## History
For a full overview of changes, see [CHANGES.md](CHANGES.md) For a full overview of changes, see [CHANGES.md](CHANGES.md)
## Poodinis Value Injector
Are you using the [Poodinis Dependency Injection framework](https://github.com/mbierlee/poodinis)? A value injector is available at [this](https://github.com/mbierlee/poodinis-mirage-config-injector) repository. See the README on how to use it.
## Contributing ## Contributing
Any and all pull requests are welcome! If you (only) want discuss changes before making them, feel free to open an Issue on github. Please develop your changes on (a branch based on) the develop branch. Continuous integration is preferred so feature branches are not neccessary. Any and all pull requests are welcome! If you (only) want discuss changes before making them, feel free to open an Issue on github. Please develop your changes on (a branch based on) the develop branch. Continuous integration is preferred so feature branches are not neccessary.