Would you like to contribute to the Titanium docs? To get started, sign up for an account on the Appcelerator Wiki and sign our CLA.

Skip to end of metadata
Go to start of metadata

Icon

The content on page is for the beta release of API Builder 1.10.0. You may find some information is either missing, incomplete or in general draft state.

Introduction

API Builder uses the configuration files in the project's conf directory to initialize the application and its connectors. Each JavaScript file in the directory should expose an object of key-value pairs. You may add any arbitrary key-value pair beside the one described below. The values will be passed to any method that is passed the API Builder configuration object.

Note: API key values and session object are auto-generated when you create a new project.

For environment-specific configuration files, add either .development or .production to the end of the filename. For example, foo.development.js will be used for the development environment, while foo.production.js will be used for the production environment.

If multiple files set the same keys, the value from the last file loaded will be used unless its an environment-specific file. Files are loaded based on the order returned from the OS's readdir() method. For example, if Foo.js and foo.development.js set the same key, the value in Foo.js is used since it is not environment specific. However, if Foo.development.js and foo.development.js set the same key, the value from foo.development.js is used since it is loaded last.

Since Release 5.0.0, you can override the configuration file settings with an environment variable. For the setting, you want to override, prefix the variable with ARROW_. For example, if you want to override the apikey setting, set the ARROW_APIKEY environment variable.

Example

./conf/foo.js

Settings

admin

Configures the Admin Console. The admin object may contain the following key-value pairs:

KeyTypeDefaultDescription
allowedHostsArray<String>-When the application is in production, restrict access to the Admin Console to the specified hosts
apiDocPrefixString/apidocPath to access the generated API docs
cssArray<String>-CSS files to inject to customize the styling of the Admin Console and API docs. Files must be relative to ./web/public/ folder or absolute URLs.

customHTMLErrorPage

String-HTML content to display for unauthorized access (HTTP 401 error code).
disableAuthBooleanfalseSet to true to disable authorization to access the Admin Console console.
disableAPIDocBooleanfalseSet to true to not display the generated API Docs.

enableAdminInProduction

BooleanfalseSet to true to enable the Admin Console in the production environment. Note: as of CLI 6.0.0 and Arrow 1.8.8, this default value is false. Previously, it was set to true.
enabledBooleantrueSet to true to enable the Admin Console.
jsArray<String>-JavaScript files to inject to customize the styling of the Admin Console and API docs. Files must be relative to ./web/public/ folder or absolute URLs.
prefixString/arrowPath to access the Admin Console.

validEmails

Array<String>developer's e-mail addressWhen the application is in production, restrict access to the Admin Console to the specified accounts.

validOrgs

Array<Number>developer's organizationWhen the application is in production, restrict access to the Admin Console to the specified organizations.

apikey_development

Generated API key used when testing the application, that is, running the application locally.

apikey_production

Generated API key used when running the application in production, that is when it is deployed to Arrow Cloud.

APIKeyAuthPlugin

Location of the authorization module if APIKeyAuthType is set to plugin.

For details, see Authentication Schemes.

APIKeyAuthType

String value indicating the authorization type for the application. By default, it is set to basic.

For details, see Authentication Schemes.

apiPrefix

Prefix path to use for the API requests for Models and APIs. Each endpoint you define in a Model or API will be prefixed by this value. By default, it is set to /api.

bodyParser

Configures body-parser middleware settings. The bodyParser object may contain the following key-value pairs:

KeyTypeDefaultDescription
limitNumber/String'1mb'Sets the maximum request body size in bytes for the body parser middleware.

busboy

Configuration object to pass to the busboy constructor, which is created when the API Builder middleware is initialized. For properties, you can set, see the busboy documentation.

connectors

Configures the connectors used by the application. The connectors field is an object of key-value pairs where the key is the name of the connector and the value is another key-value pair object used to configure the connector. The configuration object is specific to each connector.

Most connectors will have their own default configuration file in the conf directory.

cors

Configures the CORS settings. The cors object may contain the following key-value pairs:

KeyTypeDescription

Access-Control-Allow-Origin

StringSpecifies the URI that can access the server. Defaults to all.
safeHeadersArray<String>HTTP headers to expose and allow, that is, the specified value is set for Access-Control-Expose-Headers and Access-Control-Allow-Headers.

defaultConnector

Specify the name of the default connector. Used if a Model does not specify one.

ignoreDuplicateModels

Set to true to ignore duplicate Model definitions. Defaults to false, which will throw an error if a model definition is duplicated.

logging

Configures the logger utility. The logging object may contain the following key-value pairs:

KeyTypeDefaultDescription
logdirString./logsLocation of the transaction logs if enabled

transactionLogEnabled

BooleantrueSet to true to enable transaction logs

logLevel

Sets the log level for the logger utility. Accepted values are debugerrorfatalinfotrace, or warn.

port

Sets the port number for the server if the PORT environment variable is not set. By default, the port is set to 8080.

ssl

Configures SSL settings for the server. The ssl object may contain the following key-value pairs:

KeyTypeDefaultDescription

port

Number8443SSL port number

2 Comments

    1. Brian Immel

      Do you agree with Alasdair Hurst that this topic is a duplicate? If so, which one to delete?