spec-3nweb-server 1.7.11 → 1.7.12

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2023 3NSoft Inc.
3
+ Copyright (C) 2023, 2025 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.parseProcessArgv = void 0;
20
- const path_1 = require("path");
20
+ const default_confs_1 = require("../default-confs");
21
21
  const run_cmd_1 = require("./run-cmd");
22
22
  const signup_cmd_1 = require("./signup-cmd");
23
23
  const utils_1 = require("./utils");
@@ -46,22 +46,21 @@ function mainUsage(execName) {
46
46
  }
47
47
  function parseProcessArgv() {
48
48
  const args = process.argv.slice(2);
49
- const execName = (0, path_1.basename)(process.argv0);
50
49
  if (args.length === 0) {
51
- return (0, utils_1.toUsageDisplay)(0, mainUsage(execName));
50
+ return (0, utils_1.toUsageDisplay)(0, mainUsage(default_confs_1.EXECUTABLE_NAME));
52
51
  }
53
52
  if (args[0] === run_cmd_1.runCmd.name) {
54
- return (0, run_cmd_1.parseRunArgs)(args.slice(1), execName);
53
+ return (0, run_cmd_1.parseRunArgs)(args.slice(1), default_confs_1.EXECUTABLE_NAME);
55
54
  }
56
55
  else if (args[0] === signup_cmd_1.signupCmd.name) {
57
- return (0, signup_cmd_1.parseSignupArgs)(args.slice(1), execName);
56
+ return (0, signup_cmd_1.parseSignupArgs)(args.slice(1), default_confs_1.EXECUTABLE_NAME);
58
57
  }
59
58
  else {
60
59
  const opts = (0, utils_1.parseArgv)(args, [utils_1.helpOpt], { partial: true });
61
60
  if (opts.help) {
62
- return (0, utils_1.toUsageDisplay)(0, mainUsage(execName));
61
+ return (0, utils_1.toUsageDisplay)(0, mainUsage(default_confs_1.EXECUTABLE_NAME));
63
62
  }
64
- return (0, utils_1.toUsageDisplay)(-1, (0, utils_1.toErrorUsage)(mainUsage(execName), `Unknown command '${args[0]}'`));
63
+ return (0, utils_1.toUsageDisplay)(-1, (0, utils_1.toErrorUsage)(mainUsage(default_confs_1.EXECUTABLE_NAME), `Unknown command '${args[0]}'`));
65
64
  }
66
65
  }
67
66
  exports.parseProcessArgv = parseProcessArgv;
@@ -0,0 +1,3 @@
1
+ export declare const EXECUTABLE_NAME = "3nweb";
2
+ export declare const DEFAULT_DATA_ROOT_PATH = "/var/3nweb";
3
+ export declare const DEFAULT_CONFIG_PATH = "/etc/3nweb/conf.yaml";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2025 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.DEFAULT_CONFIG_PATH = exports.DEFAULT_DATA_ROOT_PATH = exports.EXECUTABLE_NAME = void 0;
20
+ exports.EXECUTABLE_NAME = '3nweb';
21
+ exports.DEFAULT_DATA_ROOT_PATH = '/var/3nweb';
22
+ exports.DEFAULT_CONFIG_PATH = `/etc/3nweb/conf.yaml`;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2023 3NSoft Inc.
3
+ Copyright (C) 2023, 2025 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -19,9 +19,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.readYamlConfFile = void 0;
20
20
  const fs_1 = require("fs");
21
21
  const yaml = require("js-yaml");
22
+ const default_confs_1 = require("./default-confs");
22
23
  function readYamlConfFile(path) {
23
24
  const txt = (0, fs_1.readFileSync)(path, 'utf8');
24
25
  const conf = yaml.load(txt);
26
+ if (conf.rootFolder) {
27
+ conf.rootFolder = default_confs_1.DEFAULT_DATA_ROOT_PATH;
28
+ }
25
29
  return conf;
26
30
  }
27
31
  exports.readYamlConfFile = readYamlConfFile;
package/build/main.d.ts CHANGED
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};
package/build/main.js CHANGED
@@ -1,6 +1,7 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  /*
3
- Copyright (C) 2015 - 2016, 2019 3NSoft Inc.
4
+ Copyright (C) 2015 - 2016, 2019, 2025 3NSoft Inc.
4
5
 
5
6
  This program is free software: you can redistribute it and/or modify it under
6
7
  the terms of the GNU General Public License as published by the Free Software
@@ -21,6 +22,7 @@ const from_yaml_1 = require("./config/from-yaml");
21
22
  const letsencrypt_1 = require("./config/letsencrypt");
22
23
  const lib_1 = require("./lib");
23
24
  const signup_1 = require("./config/signup");
25
+ const default_confs_1 = require("./config/default-confs");
24
26
  async function run(conf) {
25
27
  if (!conf.servicesConnect) {
26
28
  console.error(`No connection settings found in ??.`);
@@ -112,12 +114,11 @@ function showUsage({ txtToDisplay, exitStatus }) {
112
114
  process.exit(exitStatus);
113
115
  }
114
116
  function assembleConfig(configPath) {
115
- if (configPath) {
116
- return (0, from_yaml_1.readYamlConfFile)(configPath);
117
- }
118
- else {
119
- throw new Error(`Config path must be given`);
117
+ if (!configPath) {
118
+ configPath = default_confs_1.DEFAULT_CONFIG_PATH;
119
+ console.log(`Looking for configuration in default location: ${configPath}`);
120
120
  }
121
+ return (0, from_yaml_1.readYamlConfFile)(configPath);
121
122
  }
122
123
  async function displaySignupInfo(conf) {
123
124
  if (!conf.signup) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "spec-3nweb-server",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
4
4
  "description": "3NWeb spec server.",
5
5
  "main": "build/lib.js",
6
6
  "types": "build/lib.d.ts",
7
7
  "bin": {
8
- "3nweb": "node build/main.js"
8
+ "3nweb": "build/main.js"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc -p ts-code",