銷售: 1-800-867-1380

config module

更新日期: 2013年11月

Provides access to mobile service-specific configuration settings in Windows Azure Mobile Services

This object contains the following members:

Properties

The following configuration properties for the mobile service are accessed from this module.

 

Name Returns Description

applicationKey

string

The application key for the mobile service, which is distributed with the application. Because this key is not encrypted, it cannot be considered secure. To secure access to you mobile service data, you must instead authenticate users before allowing accessing. For more information, see 管理金鑰.

appSettings

JSON object

A JSON object of custom key-value pairs defined in the mobile service. These settings are used to securely store credentials for other Windows Azure and third-party services. For more information, see 應用程式設定.

crossDomainWhitelist

string

The names of the hosts that are permitted to make cross-domain calls to the mobile service. The host names are returned as a string representation of an array of JSON objects, one for each pair. For more information, see 跨原始資源共用.

dynamicSchemaEnabled

string

A Boolean value that is True when dynamic schema is enabled; otherwise False. For more information, see 動態結構描述.

facebookAppID

string

The app ID registered when using the Facebook identity provider for authentication. For more information, see 設定身分識別.

facebookAppSecret

string

The secret for the app ID registered when using the Facebook identity provider for authentication. For more information, see 設定身分識別.

googleClientID

string

The client ID registered when using the Google identity provider for authentication. For more information, see 設定身分識別.

googleClientSecret

string

The client secret registered when using the Google identity provider for authentication. For more information, see 設定身分識別.

masterKey

string

The service master key for you mobile service.

security安全性 附註
This key is an important secret that provides administrator access to your mobile service and data. It is accessible in plain text on the config module and should not be returned to client apps. For more information, see 管理金鑰. For more information, see 管理金鑰. For more information, see 管理金鑰.

mobileServiceName

string

The name of the mobile service instance.

sqlConnectionString

string

The connection string used to access the Windows Azure SQL Database used by the mobile service. This string includes credentials used to access the service and is accessible in plain text on the config module.

twitterConsumerKey

string

The consumer key registered when using the Twitter identity provider for authentication. For more information, see 設定身分識別.

twitterConsumerSecret

string

The secret for the consumer key registered when using the Twitter identity provider for authentication. For more information, see 設定身分識別.

The following custom API example uses the supplied service 物件 to retrieve an app setting value:

exports.get = function(request, response) {
    // Get the MY_CUSTOM_SETTING value from app settings.
    var customSetting = 
        request.service.config.appSettings.my_custom_setting;

    // Do something and then send a response.
}

The following code uses the configuration module to access Twitter credentials, stored in app settings, that is used in a scheduled job script:

// Get the app settings from the service configuration module.
var settings = require('mobileservice-config').appSettings;

// Get your Twitter v1.1 access credentials from app settings.
var consumerKey = settings.TWITTER_CONSUMER_KEY,
    consumerSecret = settings.TWITTER_CONSUMER_SECRET,
    accessToken= settings.TWITTER_ACCESS_TOKEN,
    accessTokenSecret = settings.TWITTER_ACCESS_TOKEN_SECRET;

In a service operation, the config module is accessed from the service 物件. Because the config module is not available in table operation and scheduled job scripts, you must require the configuration module to access your mobile service configuration.

本文對您有任何幫助嗎?
(剩餘 1500 個字元)
感謝您提供意見

社群新增項目

Microsoft 正展開一份線上問卷調查,了解您對於 MSDN 網站的看法。 如果您選擇參加,您離開 MSDN 網站時即會顯示線上問卷調查。

您是否想要參加?
顯示:
© 2014 Microsoft