Examples and insights on typesafehub
Config
library
Config is a configuration library for JVM languages. It is implementated in plain Java with no additional dependencies and supports files in Java properties, JSON and a human-friendly JSON superset.
This repository explores its capabilities and extensibility points in different examples, from the simplest ones to the more complex.
Also, this document will collect written details that I've found difficult to grasp by reading the official docs on https://github.com/typesafehub/config.
- Run the examples from the official docs
- Learn how to specify the configuration in several files (common, classes)
- Learn how to implement a waterfall approach (external file >> environment vars >> Java Properties >> file in jar)
- Learn how to switch that JSON superset for YAML
- How to support profiles
- How to use different filenames than provided
- Explore what the doc says: A config can be created with the parser methods in ConfigFactory or built up from any file format or data source you like with the methods in
ConfigValueFactory
. - Use static functions rather than
new
(FactoryIdiom) - Create a class that accepts a parameter or environment variable to load profile or section of the config
- Explore configFactory.systemEnvironment()
- Parsing and transforming between environment variables and config params (as nconf does)
- Encryption?
- license
Illustrates how to read the configuration properties using the default mechanism of the Config library
Illustrates how to read the configuration properties using the default mechanism of the Config library
Illustrates how to read the configuration properties using the default mechanism of the Config library
Illustrates how to customize the location and name of the file that contains the application configuration
Illustrates how to merge config trees to implement a waterfall configuration in which a precedence is established between different configuration sources.
Illustrates how to create a Config
object from a YAML file.
Illustrates how to restrict the loading of configuration properties only to a certain node of the whole configuration properties, emulating the same behavior as Spring does with profiles.
Illustrates how to create a singleton (eagerly-loaded singleton) to hold the configuration.
Illustrates how to enable encryption on sensitive config entries.