@opengis/fastify-table 1.1.33 → 1.1.34

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.1.33",
3
+ "version": "1.1.34",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",
@@ -23,7 +23,7 @@ export default async function loggerFile({
23
23
  if (access?.status === 403 && !config?.local) return access;
24
24
 
25
25
  // absolute / relative path
26
- const rootDir = getRootDir(config);
26
+ const rootDir = getRootDir();
27
27
 
28
28
  const filepath = path.join(rootDir, params['*'] || '');
29
29
 
@@ -1,14 +1,17 @@
1
1
  import path from 'path';
2
- // import { existsSync } from 'fs';
2
+ import fs from 'fs';
3
+ import config from '../../../config.js';
3
4
 
4
- export default function getRootDir(config) {
5
+ // import { existsSync } from 'fs';
6
+ let logDir = null;
7
+ export default function getRootDir() {
5
8
  // absolute / relative path
6
- if (config.log?.dir) {
7
- return config.log.dir.startsWith('/') || config.log.dir.includes(':')
8
- ? config.log.dir
9
- : path.join(process.cwd(), config.log.dir);
10
- }
11
- return path.join(process.cwd(), 'log');
9
+ if (logDir) return logDir;
10
+ const file = ['config.json', '/data/local/config.json'].find(el => (fs.existsSync(el) ? el : null));
11
+ const root = file === 'config.json' ? process.cwd() : '/data/local';
12
+ logDir = config.logDir || path.join(root, config.log?.dir || 'log');
13
+ console.log({ logDir });
14
+ return logDir;
12
15
 
13
16
  // windows debug support
14
17
  /* const customLogDir = process.cwd().includes(':') ? 'c:/data/local' : '/data/local';