| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/provisioner/lib/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const nami_wrapper_1 = require("./nami_wrapper");
class ProvisionerOptionsHandler {
constructor() {
this.options = {};
}
/**
* Parse options from text, reading each line as name=value parameters, skipping comments
*/
initializeFromText(text) {
for (let line of text.split("\n")) {
let match = line.match(/^\s*(.+?)\s*=\s*(.*)\s*$/);
// parse all lines that are not comments
if (match && !match[1].match(/^#/)) {
this.options[match[1]] = match[2];
}
}
}
/**
* Read options from a file
*/
initializeFromFile(path) {
this.initializeFromText(nami_wrapper_1.file.read(path));
}
/**
* Returns whether a specified option was provided
*/
provided(key) {
return Object.keys(this.options).indexOf(key) >= 0;
}
/**
* Return whether specified option is set to true
*/
isTrue(key, defaultValue) {
return !!this.getValue(key, defaultValue ? "y" : "n").toLowerCase().match(/^y|t|1/);
}
/**
* Return value for specified option
*/
getValue(key, defaultValue) {
return this.provided(key) ? this.options[key] : defaultValue;
}
}
exports.ProvisionerOptionsHandler = ProvisionerOptionsHandler;