Managing development keys

There are many ways to manage keys on dev, staging and development environments and we offer another approach that you can use on Smartface Cloud platform.

First you should store your variables on config.json file in scripts folder.

You can parse your variables via File component in your application like the following.

JavaScript
JavaScript
const Page = require('sf-core/ui/page');
const extend = require("js-base/core/extend");
const Path = require('sf-core/io/path');
const File = require('sf-core/io/file');
const FileStream = require('sf-core/io/filestream');
const Page1 = extend(Page)(
function(_super) {
_super(this);
var file = new File({path: Path.DataDirectory + "/scripts/config.json"});
var fileStreamRead = file.openStream(FileStream.StreamType.READ, FileStream.ContentMode.TEXT);
var myConfigJSON = JSON.parse(fileStreamRead.readToEnd());
console.log("BASE URL = " + myConfigJSON.BASE_URL);//output = https://dev-api.smartface.io
});
module && (module.exports = Page1);

Send your application to testing distribution. After your tests are completed you can publish your application to Enterprise App Store or App Stores.

On this step, you can view and check your config file by pressing "Show Config" link.

Finally you can change the config file in your application with your live keys.