Skip to content

Commit

Permalink
Merge pull request #42 from SentryMan/patch-1
Browse files Browse the repository at this point in the history
Show example of profiles using load properties
  • Loading branch information
rbygrave authored Feb 8, 2023
2 parents 5be98ee + 747a006 commit 0036d26
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![Maven Central : avaje-config](https://maven-badges.herokuapp.com/maven-central/io.avaje/avaje-config/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.avaje/avaje-config)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](/~https://github.com/avaje/avaje-config/blob/master/LICENSE)

# [Avaje Config](https://avaje.io/config/)

# Application configuration
This library loads properties files that can be used to configure
an application including "testing" and "local development" and
dynamic configuration (changes to configuration properties at runtime).
Expand All @@ -16,10 +16,6 @@ dynamic configuration (changes to configuration properties at runtime).
</dependency>
```

## Documentation

Go to [avaje.io/config](https://avaje.io/config/) for user documentation.

## Typical use

- Put application.yaml into src/main/resources for properties that have reasonable defaults
Expand Down Expand Up @@ -83,14 +79,17 @@ Below is the how it looks for configuration properties.

- loads via `load.properties` property.

We can define a `load.properties` property which has name of property file in resource folder, or path locations for other properties/yaml files to load
We can define a `load.properties` property which has name of property file in resource folder, or path locations for other properties/yaml files to load.

`load.properties` is pretty versatile and can even be chained. For example, in your main application properties, you can have `load.properties=application-${profile:local}.properties` to load based on the profile environment variable/-Dprofile JVM arg, and in the loaded properties you can add `load.properties` there to load more properties and so on.

Example application.properties:
```
common.property=value
load.properties=application-extra.properties,path/to/prop/application-extra2.properties
load.properties=application-${profile:local}.properties,path/to/prop/application-extra2.properties
```


- loads test resources (if they exist, nb: Test resources are only visible when running tests)
- application-test.properties
- application-test.yaml
Expand All @@ -110,3 +109,5 @@ Command line arguments starting with `-P` can specify properties/yaml files to l

When properties are loaded they are merged/overlayed.

### config.load.systemProperties
If we set `config.load.systemProperties` to true then all the properties that have been loaded are then set into system properties.

0 comments on commit 0036d26

Please sign in to comment.