-
Notifications
You must be signed in to change notification settings - Fork 16
Sensitive and Common Data
You often have sensitive data like usernames, passwords, keys, ... that are used throughout projects, and that you don't want to commit with your codebase. Other data like global or machine-specific configuration values are also better stored outside your project.
bld provides access to RIFE2's hierarchical properties
infrastructure and allows you to put this sensitive data anywhere in the hierarchy
that makes sense to you.
Since bld doesn't execute in a web environment, the property collection
hierarchy is different:
Project Properties
↓
Java System Properties
↓
[Local Properties File]
↓
[Bld Properties File]
↓
[Custom Properties File]
↓
System Env Variables
-
[Local Properties File]is an optional properties file namedlocal.propertiesthatbldwill search for in the top-level directory of your project. -
[Bld Properties File]is another optional properties file namebld.propertiesthatbldwill search for in your home directory at$HOME/.bld/bld.properties -
[Custom Properties File]is a third optional properties file that will be looked for at the location set in theRIFE2_PROPERTIES_FILEenvironment variable.
Once you have set up the properties in any of the locations in the hierarchy, you can easily access them in your project.
For example:
public class MyAppBuild extends WebProject {
public MyAppBuild() {
// ...
publishOperation()
.repository(
repository("https://repo.rife2.com/releases",
property("rife2.username"),
property("rife2.password")))
.info()
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
// ...
}
// public static void main ...
}Now, imagine that you have set up rife2.username and rife2.password in
$HOME/.bld/bld.properties, but that you temporarily want to use different
values, then you can for instance use Java system properties to override them:
./bld -Drife2.username=other_user -Drife2.password=other_pass clean publishRIFE2's hierarchical properties are a really powerful and convenient way to externalize data.
Next learn more about Upgrading