@nasriya/orchestriq
Version:
A package to generate Docker files
27 lines (26 loc) • 952 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class Environment {
#_environment = {};
/**
* Gets the environment variables for the service.
* @returns {Record<string, string>} An object containing the environment variables.
*/
get list() { return this.#_environment; }
/**
* Adds a set of key-value pairs to the environment.
* @param value A record of key-value pairs to add to the environment.
* @throws {TypeError} If the provided value is not a non-empty object of key-value pairs.
*/
add(value) {
if (typeof value === 'object' && Object.keys(value).length > 0) {
for (const [key, val] of Object.entries(value)) {
this.#_environment[key] = String(val);
}
}
else {
throw new TypeError('Environment must be an object of key-value pairs.');
}
}
}
exports.default = Environment;