Embedded feature flags give teams the ability to pack CloudBees Feature Management data (Feature Flags) at build time.
The ability to pack custom deployment rules and configurations at build time allows teams to control elements which are required at startup time without introducing any latency (fetching data from the network).
As opposed to default values which handle flag defaults, embedded feature flags allow for custom default deployment rules, i.e: open a feature only for beta users in the US.
Below are Android, iOS, and JavaScript embedded feature flags installation instructions.
Android
Installation
See Gradle plugin page for the installation notes.
Configuration
The plugin is able to find all the necessary information from Android sources automatically.
By default, it looks for ROX app key in AndroidManifest.xml
. But this can be changed via the resValue
config
in build.gradle
:
defaultConfig {
resValue "string", "ROLLOUT_KEY", "<ROLLOUT_KEY>"
}
buildTypes {
debug {
resValue "string", "ROLLOUT_KEY", "<DEBUG_ROLLOUT_KEY>"
}
release {
resValue "string", "ROLLOUT_KEY", "<RELEASE_ROLLOUT_KEY>"
}
}
Another way of overriding default values is specifying them in Gradle’s rox
extension.
Config property names, and their default values are below:
rox {
resKey "ROLLOUT_KEY" // resValue key to extract appKey
xmlKey "rox.apiKey" // android manifest key to extract appKey
host "https://x-api.rollout.io" // host to get configuration from
platform "Android" // platform to send with request
fieldName "ROX_EMBEDDED_CONFIGURATION" // field name in BuildConfig.class which stores the configuration
groupId "io.rollout.rox" // groupId to identify the version of the sdk
artifactId "rox-android" // artifactId to identify the artifact name of the sdk
buildTypes "release,debug" // list of build types, separated by ',' - to apply to plugin for. Empty string "" Stands for _all_ build types. This is the default.
apiVersion "1.8" // ROX API version
}
Java Server
Java Server has both Gradle and Maven plugins for the two popular build automation tools.
Gradle Plugin
See Gradle plugin page for the installation notes.
After installing plugin, specify your app key in build.gradle
:
rox {
appKey "<ROLLOUT_KEY>"
}
Following is the complete list of plugin properties, and their default values:
rox {
appKey "" // appKey value
host "https://x-api.rollout.io" // host to get configuration from
platform "Java" // platform to send with request
fileName ".rox-embedded-configuration.json" // the name of the embedded configuration file located in the classpath
groupId "io.rollout.rox" // groupId to identify the version of the sdk
apiVersion "1.8" // ROX API version
}
Maven Plugin
Installation
Add both rox-java-server
and rox-configuration-maven-plugin
dependencies to your pom.xml
:
<project>
...
<dependencies>
<dependency>
<groupId>io.rollout.rox</groupId>
<artifactId>rox-java-server</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>io.rollout.rox</groupId>
<artifactId>rox-configuration-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<key>YOUR_APP_KEY</key>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Configuration
Tag | Default value | Description |
---|---|---|
| - | Application key. |
| Host to get configuration from. | |
|
| Platform to send with request. |
|
| The name of the embedded configuration file located in the classpath. |
|
|
|
|
| ROX API version. |
iOS
Add a new Run Script phase to your target, with the following line
“${SRCROOT}“/Pods/ROXCore/lib/store_rox_configuration.sh -k “<your_app_key>”
JavaScript
-
Install the plugin -
npm install --save-dev rox-embedded-webpack
. -
Add the plugin to you Webpack config.
const ROXEmbeddedPlugin = require('rox-embedded-webpack-plugin');
module.exports = {
entry: //...,
output: //...,
plugins: [
new ROXEmbeddedPlugin(options)
]
}
Where options
in an object with the following keys
{
app: <YOUR APP KEY>,
platform: <YOUR_PLATFORM_OF_CHOICE>, // (you can use 'Browser' here)
output: <ABS_TEMPORARY_OUTPUT_DIR> // (OPTIONAL)
}