mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-20 13:39:10 -06:00
dev: cleanup RuntimeEnvironment.js
This commit is contained in:
@@ -93,8 +93,7 @@ const path_checks = ({ logger }) => ({ fs, path_ }) => ({
|
||||
throw new Error(`No valid config file found in path: ${path}`);
|
||||
},
|
||||
env_not_set: name => () => {
|
||||
if ( process.env[name] ) return false;
|
||||
return true;
|
||||
return ! process.env[name];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -283,9 +282,8 @@ class RuntimeEnvironment extends AdvancedBase {
|
||||
);
|
||||
const config_values = JSON.parse(config_raw);
|
||||
for ( const k in generated_values ) {
|
||||
if ( config_values[k] ) {
|
||||
generated_values[k] = config_values[k];
|
||||
}
|
||||
if ( ! config_values[k] ) continue;
|
||||
generated_values[k] = config_values[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,9 +328,6 @@ class RuntimeEnvironment extends AdvancedBase {
|
||||
throw new Error('config_name is required');
|
||||
}
|
||||
this.logger.info(hl(`config name`) + ` ${quot(config.config_name)}`);
|
||||
// console.log(config.services);
|
||||
// console.log(Object.keys(config.services));
|
||||
// console.log({ ...config.services });
|
||||
|
||||
const mod_paths = [];
|
||||
environment.mod_paths = mod_paths;
|
||||
@@ -359,12 +354,13 @@ class RuntimeEnvironment extends AdvancedBase {
|
||||
}
|
||||
|
||||
get_first_suitable_path_ (meta, paths, last_checks) {
|
||||
iter_paths:
|
||||
for ( const entry of paths ) {
|
||||
const checks = [...(entry.checks ?? []), ...last_checks];
|
||||
this.logger.info(
|
||||
`Checking path ${quot(entry.label ?? entry.path)} for ${meta.pathFor}...`
|
||||
);
|
||||
|
||||
let checks_pass = true;
|
||||
for ( const check of checks ) {
|
||||
this.logger.info(
|
||||
`-> doing ${quot(check.name)} on path ${quot(entry.path)}...`
|
||||
@@ -374,9 +370,12 @@ class RuntimeEnvironment extends AdvancedBase {
|
||||
this.logger.info(
|
||||
`-> ${quot(check.name)} doesn't like this path`
|
||||
);
|
||||
continue iter_paths;
|
||||
checks_pass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! checks_pass ) continue;
|
||||
|
||||
this.logger.info(
|
||||
`${hl('USING')} ${quot(entry.path)} for ${meta.pathFor}.`
|
||||
|
||||
Reference in New Issue
Block a user