@knetik/knetikcloud-env-init
v3.1.10
Published
Data is defined one request per json file.
Downloads
26
Readme
DATA DEFINITIONS
Data is defined one request per json file.
{
// https://github.com/knetikmedia/knetikcloud-javascript-client
// knetikcloud client class
"class_name": "BRERuleEngineRulesApi",
// knetikcloud client create and update methods
"save_method": "createBRERule",
"update_method": "updateBRERule",
// objects that should be processed before this file
"depends_on": ["triggers/notifications/send_to_email.json"],
// Create method params signature as defined at https://integration.knetikcloud.com/api.html
// Optional. If not provided, method params are dynamically extracted.
"save_params": [ "opts" ]
// Update method params signature as defined at https://integration.knetikcloud.com/api.html
// Optional. If not provided, method params are dynamically extracted.
"update_params": [ "id", "opts" ]
// Methods arguments. Provide values to methods params.
"args": [
{ "id": 1, "opts": {} }
]
}
CONFIG VALUES PER ENVIRONMENT
Some object elements may change for each env (dev, stage, prod). When this is
the case, create a config.json file and add your environment specific variables
there. When the file is processed Mustache is used to replace dynamic elements
inside the module's opts
array with matching values from the config.json file.
Keep in mind, the json object definition file must still be valid json.
./config.json
{
"jsapi_app_id": "thermo-dev"
}
./data/configs/jsapi_app_id.json
{
"class_name": "ConfigsApi",
"method": "createConfig",
"depends_on": [],
"opts": [{ "config": {
"name":"jsapi_app_id",
"value":"{{jsapi_app_id}}",
"public_read":false
}}]
}
// resutling in
{
"class_name": "ConfigsApi",
"method": "createConfig",
"depends_on": [],
"opts": [{ "config": {
"name":"jsapi_app_id",
"value":"thermo-dev",
"public_read":false
}}]
}
TESTING DATA OBJECTS
Print all data objects to the console for review
knetikcloud-init test
Print a single data object to the console for review
knetikcloud-init test -p <path to object json file>
IN APP USAGE
const Builder = require('knetikcloud-env-init')
const builder = new Builder({
app_id: 'knetikcloud_app_id',
token: 'knetikcloud_admin_token',
data_dir: 'relative path to your data root' // optional
config_path: 'relative path to your config.json file' // optional
configs: 'valid json object for dynamic variable replacement' // optional
})
builder.result()
CLI
Install
npm install -g knetikmedia/knetikcloud-init-client
Usage
knetikcloud-init help