polyv-live-cli
Version:
CLI tool for managing PolyV live streaming services.
54 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountConfigValidation = exports.ENVIRONMENT_BASE_URLS = void 0;
exports.getAccountBaseUrl = getAccountBaseUrl;
exports.getEnvironmentLabel = getEnvironmentLabel;
exports.ENVIRONMENT_BASE_URLS = {
development: 'https://api-dev.polyv.net',
production: 'https://api.polyv.net',
test: 'https://develop-3-api.polyv.net'
};
exports.AccountConfigValidation = {
name: {
required: true,
pattern: /^[a-zA-Z0-9_-]+$/,
maxLength: 50,
minLength: 1
},
appId: {
required: true,
pattern: /^[a-zA-Z0-9]+$/,
minLength: 8,
maxLength: 32
},
appSecret: {
required: true,
minLength: 16,
maxLength: 128
},
environment: {
required: false,
validValues: ['development', 'production', 'test', 'custom']
},
baseUrl: {
required: false,
pattern: /^https?:\/\/.+/,
maxLength: 200
}
};
function getAccountBaseUrl(account) {
if (account.baseUrl) {
return account.baseUrl;
}
if (account.environment && account.environment !== 'custom') {
return exports.ENVIRONMENT_BASE_URLS[account.environment];
}
return exports.ENVIRONMENT_BASE_URLS.production;
}
function getEnvironmentLabel(account) {
if (account.baseUrl && account.environment === 'custom') {
return 'custom';
}
return account.environment || 'production';
}
//# sourceMappingURL=account.types.js.map