45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
var path = require('path');
|
|
|
|
exports = module.exports = {
|
|
TESTAPP_ID: 'io.cloudron.testapp',
|
|
TESTAPP_VERSION : '1.0.2',
|
|
|
|
cloudronDomain: cloudronDomain,
|
|
verifyResponse: verifyResponse,
|
|
getOwner: getOwner,
|
|
stripeSecret: stripeSecret
|
|
};
|
|
|
|
var gNow = ((new Date()).getTime() / 1000).toFixed();
|
|
var gEcosystem = null;
|
|
try {
|
|
gEcosystem = require(path.join(__dirname, '../keys/appstore/ecosystem-staging.json'));
|
|
} catch (e) {
|
|
}
|
|
|
|
function cloudronDomain(filename) {
|
|
return 't-' + path.basename(filename, '-test.js') + '-' + gNow + '.smartserver.io';
|
|
}
|
|
|
|
function verifyResponse(res, errorMessage) {
|
|
if (res.statusCode < 200 || res.statusCode > 299) {
|
|
console.log('Response error statusCode:%s error:%s body:%s', res.statusCode, res.error, res.body);
|
|
console.log(errorMessage.red);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
function getOwner() {
|
|
return {
|
|
username: process.env.APPSTORE_USERNAME || gEcosystem.APPSTORE_USERNAME,
|
|
password: process.env.APPSTORE_PASSWORD || gEcosystem.APPSTORE_PASSWORD,
|
|
email: process.env.APPSTORE_EMAIL || gEcosystem.APPSTORE_EMAIL
|
|
};
|
|
}
|
|
|
|
function stripeSecret() {
|
|
return process.env.STRIPE_SECRET;
|
|
}
|