Skip to content

Commit 7675259

Browse files
author
mccabd
committed
REadme update
1 parent bacd35c commit 7675259

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

README.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
[![Maven Central](https://img.shields.io/maven-central/v/com.github.bordertech.config/config.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.bordertech.config%22%20AND%20a:%22config%22)
1111

1212
## Content
13-
1413
- [What is Config](#what-is-config)
1514
- [Why use Config](#why-use-config)
1615
- [Getting started](#getting-started)
@@ -29,7 +28,6 @@ The [features](#features) of the [Default Configuration](https://github.com/Bord
2928
Projects can easily override this default implementation via the [configuration](#configuration) settings.
3029

3130
## Getting started
32-
3331
Add dependency:
3432

3533
``` xml
@@ -62,8 +60,7 @@ my.example=a-override-value
6260
## Features
6361

6462
### Predefined property resources
65-
66-
The default implementation looks for the following resources:
63+
The default implementation looks for the following resources either as a classpath resource or a URL:
6764

6865
- `bordertech-defaults.properties` - framework defaults
6966
- `bordertech-app.properties` - application properties
@@ -77,26 +74,23 @@ The resources loaded into the Configuration can be overridden via [configuration
7774

7875
### Include resources
7976
Other property files can be included from other predefined property files.
80-
If the "include" property is defined, it is treated as a (comma-separated) list of additional resources to load that are processed immediately within the current resource being loaded
81-
82-
Variable substitution is not allowed for the resource name(s)
77+
If the "include" property is defined, it is treated as a (comma-separated) list of additional resources (classpath resource or a URL)
78+
to load that are processed immediately within the current resource being loaded
8379

8480
``` java properties
8581
include=include_resource_1.properties[,include_resource_2.properties]
8682
```
8783

8884
### IncludeAfter resources
8985
Other property files can be included from the predefined property file after the current set has loaded.
90-
If this property is defined, it is taken as a (comma-separated) list of additional resources to load that are processed after the current (set of) resources have loaded.
91-
92-
Variable substitution is allowed for the resource name(s)
86+
If this property is defined, it is treated as a (comma-separated) list of additional resources (classpath resource or a URL)
87+
to load that are processed after the current (set of) resources have loaded.
9388

9489
``` java properties
9590
includeAfter=include_resource_1.properties[,include_resource_2.properties]
9691
```
9792

9893
### += Append values to predefined properties
99-
10094
Config also allows for the ability to append values to properties already defined.
10195
This is done using '+=' instead of '=' on a key-value pair. Suggested use case is you have a global default set and then
10296
you want to append application specific values to the default values for access within an application.
@@ -114,7 +108,7 @@ already.defined.key+=value2,value3
114108
### Profiles
115109
Profiles allow you to map properties to different profiles - for example, dev, test, prod or mock.
116110
We can activate these profiles in different environments to set(override) the properties we need.
117-
The profile property can be defined as either an environment variable or a JVM system property.
111+
The profile property can be defined as either an OS environment variable or a JVM system property.
118112

119113
When a property with the key `bordertech.config.profile` is set, it is used as the suffix for each property lookup:
120114

@@ -247,25 +241,8 @@ If the `bordertech.config.spi.append.default` is true the Default Configuration
247241

248242
### Best Practice
249243

250-
Using profiles, define and deploy your `profile.properties` to your server environment and include this file in one of the
251-
resource loader property files you have configured. This profile property file could contain:
252-
- Hostnames
253-
- Database Urls
254-
- Proxy host/ports
255-
- common reference urls
256-
- anything you think can be reused by all applications
257-
258-
Using the Default configuration as the example and setting up a Test profile:
259-
- Create `config-profile.properties` containing your Test profile environment's properties:
260-
- e.g. Test profile `config.profile.hostname=testhostname`
261-
- Deploy `config-profile.propertires` to `/some/path/on/server/` in your Test environment.
262-
- Add an `include=/some/path/on/server/config-profile.properties` reference to one of these resources:
263-
- `bordertech-defaults.properties`
264-
- `bordertech-app.properties`
265-
- `bordertech-local.properties`
266-
- The `config.profile.hostname` can be accessed after the include `config-profile.properties` definition
267-
- e.g. in `bordertech-app.properties` define `app.url=https://${config.profile.hostname}/app/whatever/the/path`
268-
- When in an application in the Test env `Config.getInstance.getString("app.url")` will return `https://testhostname/app/whatever/the/path`
244+
THe Default Configuration allows you to set the profile `bordertech.config.profile` but you would normally set the profile through a
245+
JVM System Property or an OS environment variable.
269246

270247
## Contributing
271248

0 commit comments

Comments
 (0)