puppyperpetual 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "puppyperpetual",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "Run stuff FOREVER! PERPETUALLY!",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -3,15 +3,19 @@ import path from 'node:path';
3
3
  import yaml from 'js-yaml';
4
4
 
5
5
  export class ConfigManager {
6
- constructor(rootDir, serverName) {
6
+ constructor(rootDir, serverName, noYAML = false) {
7
7
  this.rootDir = rootDir;
8
8
  this.serverName = serverName;
9
9
 
10
- this.defaultConfigPath = path.join(rootDir, 'src', 'defaultconfig.yaml');
10
+ this.defaultConfigPath = path.join('src', 'defaultconfig.yaml');
11
11
  this.configPath = path.join(rootDir, 'store', 'config.yaml');
12
12
 
13
- this.ensureConfigExists();
14
- this.config = yaml.load(fs.readFileSync(this.configPath, 'utf8'));
13
+ if (!noYAML) {
14
+ this.ensureConfigExists();
15
+ this.config = yaml.load(fs.readFileSync(this.configPath, 'utf8'));
16
+ } else {
17
+ this.config = { servers: {}, pullers: [] };
18
+ }
15
19
  }
16
20
 
17
21
  ensureConfigExists() {
package/src/index.js CHANGED
@@ -7,7 +7,7 @@ import readline from 'node:readline';
7
7
  export class Perpetual {
8
8
  constructor(serverName, options) {
9
9
  const rootDir = options.rootDir || path.resolve('./');
10
- this.configManager = new ConfigManager(rootDir, serverName);
10
+ this.configManager = new ConfigManager(rootDir, serverName, options.noYAML);
11
11
  this.options = this.configManager.getServerOptions(options);
12
12
  this.logger = new Logger(this.options);
13
13
  this.processManager = new ProcessManager(this.options, this.logger, rootDir);