Skip to end of metadata
Go to start of metadata

Alloy uses the config.json file, located in the project's app directory, to specify global values, conditional environment and platform values, and widget dependencies. The configuration file contains the following objects:

Object

Description

global

Contains key-value pairs present for all environments and platforms.

env:development

Contains key-value pairs present for targets built for development, running in either the simulator or emulator.

env:test

Contains key-value pairs present for targets built for testing on a device.

env:production

Contains key-value pairs present for targets built for production, running after a package installation.

os:android

Contains key-value pairs present for targets built for Android.

os:iosContains key-value pairs present for targets built for iOS.
os:windowsContains key-value pairs present for targets built for Windows Phone. Note: Support for Windows 8.1 and Windows Phone SDKs has been deprecated as of SDK 6.3.0.GA and has be removed in SDK 7.0.0.GA.

dependencies

Contains key-value pairs for widget dependencies, where the key is the widget name and the value is the version number of the widget.

autoStyleEnables the autostyle feature for the entire Alloy project. See Dynamic Styles: Autostyle for more information.
backboneSelect the Backbone.js library to use for Alloy Model and Collection objects. Set to either 0.9.2 (default for backwards compatibility), 1.1.2. or 1.3.3.

When mixed together, 'os' values override 'env' values, which override 'global' values. If you want to specify both a platform and environment-specific configuation, combine the 'os' and 'env' values together into one string with the values space separated.  These values are accessible during runtime by prefixing the key with Alloy.CFG.

Example of a configuration file:

In the above example, if the application is ran on the iPhone simulator and prints out 'foo' using Ti.API.info(Alloy.CFG.foo), it will return '6.'