src/index.js
function getVariable(configName, variableName) {
    return new Promise(function(resolve, reject) {
        auth().then(function(authClient) {
            const projectId = process.env.GCLOUD_PROJECT;
            const fullyQualifiedName = 'projects/' + projectId
                    + '/configs/' + configName
                    + '/variables/' + variableName;

            runtimeConfig.projects.configs.variables.get({
                auth: authClient,
                name: fullyQualifiedName,
            }, function(err, res) {
                if (err) {
                    reject(err);
                    return;
                }

                const variable = res.data;
                if (typeof variable.text !== 'undefined') {
                    resolve(variable.text);
                } else if (typeof variable.value !== 'undefined') {
                    resolve(Buffer.from(variable.value, 'base64').toString());
                } else {
                    reject(new Error('Property text or value not defined'));
                }
            });
        });
    });
}
function getVariable(configName, variableName) {
    return new Promise(function(resolve, reject) {
        auth().then(function(authClient) {
            const projectId = process.env.GCLOUD_PROJECT;
            const fullyQualifiedName = 'projects/' + projectId
                    + '/configs/' + configName
                    + '/variables/' + variableName;

            runtimeConfig.projects.configs.variables.get({
                auth: authClient,
                name: fullyQualifiedName,
            }, function(err, res) {
                if (err) {
                    reject(err);
                    return;
                }

                const variable = res.data;
                if (typeof variable.text !== 'undefined') {
                    resolve(variable.text);
                } else if (typeof variable.value !== 'undefined') {
                    resolve(Buffer.from(variable.value, 'base64').toString());
                } else {
                    reject(new Error('Property text or value not defined'));
                }
            });
        });
    });
}
function getVariable ( configName , variableName ) { return new Promise ( function ( resolve , reject ) { auth ( ) . then ( function ( authClient ) { const projectId = process . env . GCLOUD_PROJECT ; const fullyQualifiedName = 'projects/' + projectId + '/configs/' + configName + '/variables/' + variableName ; runtimeConfig . projects . configs . variables . get ( { auth : authClient , name : fullyQualifiedName , } , function ( err , res ) { if ( err ) { reject ( err ) ; return ; } const variable = res . data ; if ( typeof variable . text !== 'undefined' ) { resolve ( variable . text ) ; } else if ( typeof variable . value !== 'undefined' ) { resolve ( Buffer . from ( variable . value , 'base64' ) . toString ( ) ) ; } else { reject ( new Error ( 'Property text or value not defined' ) ) ; } } ) ; } ) ; } ) ; }
runtimeConfig.getVariable

@desc Reads a runtime config value

@param {string} configName The config name of the variable to return
@param {string} variableName The variable name of the variable to return
@return {Promise} Promise that resolves the variable value
runtimeConfig . getVariable