improve config handling
This commit is contained in:
parent
b84152aac2
commit
fcd6b81668
2
dist/npmci.env.d.ts
vendored
2
dist/npmci.env.d.ts
vendored
@ -7,5 +7,5 @@ export declare let dockerRegistry: any;
|
||||
export declare let dockerFilesBuilt: Dockerfile[];
|
||||
export declare let dockerFiles: Dockerfile[];
|
||||
export declare let config: any;
|
||||
export declare let configLoad: () => void;
|
||||
export declare let configStore: () => void;
|
||||
export declare let configLoad: () => void;
|
||||
|
18
dist/npmci.env.js
vendored
18
dist/npmci.env.js
vendored
@ -7,12 +7,24 @@ exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO);
|
||||
exports.buildStage = process.env.CI_BUILD_STAGE;
|
||||
exports.dockerFilesBuilt = [];
|
||||
exports.dockerFiles = [];
|
||||
exports.configStore = function () {
|
||||
plugins.smartfile.memory.toFsSync(JSON.stringify(exports.config), {
|
||||
fileName: "config.json",
|
||||
filePath: paths.NpmciPackageRoot
|
||||
});
|
||||
};
|
||||
exports.configLoad = function () {
|
||||
try {
|
||||
exports.config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig, "json");
|
||||
}
|
||||
catch (err) {
|
||||
exports.config = {};
|
||||
exports.configStore();
|
||||
plugins.beautylog.log("config inititialized!");
|
||||
}
|
||||
exports.config.dockerRegistry ? exports.dockerRegistry = exports.config.dockerRegistry : void (0);
|
||||
exports.config.dockerFilesBuilt ? exports.dockerFilesBuilt = exports.config.dockerFilesBuilt : void (0);
|
||||
};
|
||||
exports.configStore = function () {
|
||||
};
|
||||
exports.configLoad();
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFDM0MsSUFBWSxLQUFLLF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dockerFiles:Dockerfile[] = [];
|
||||
|
||||
export let config;
|
||||
|
||||
export let configStore = () => {
|
||||
plugins.smartfile.memory.toFsSync(
|
||||
JSON.stringify(config),
|
||||
{
|
||||
fileName:"config.json",
|
||||
filePath:paths.NpmciPackageRoot
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export let configLoad = () => {
|
||||
try {
|
||||
config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig,"json");
|
||||
}
|
||||
catch(err){
|
||||
config = {};
|
||||
configStore();
|
||||
plugins.beautylog.log("config inititialized!");
|
||||
}
|
||||
|
||||
config.dockerRegistry ? dockerRegistry = config.dockerRegistry : void(0);
|
||||
config.dockerFilesBuilt ? dockerFilesBuilt = config.dockerFilesBuilt : void(0);
|
||||
}
|
||||
|
||||
export let configStore = () => {
|
||||
|
||||
}
|
||||
configLoad();
|
Loading…
Reference in New Issue
Block a user