git-proxy icon indicating copy to clipboard operation
git-proxy copied to clipboard

Default config not loaded due to excessive validation

Open coopernetes opened this issue 1 year ago • 1 comments

Describe the bug When installing Git Proxy as a package to execute & run, a configuration may be optionally provided for customization. When the --config option is omitted, it is expected that the default (bundled) proxy.config.json should be loaded in its place.

Related #526 f9c456dc708a67a688a21f3d706a71026349f179

Currently, the app fails to start due to the call to config.validate() which expects a file to exist in the current working directory:

$ git-proxy
node:fs:573
  return binding.open(
                 ^

Error: ENOENT: no such file or directory, open 'proxy.config.json'
    at Object.openSync (node:fs:573:18)
    at Object.readFileSync (node:fs:452:35)
    at Object.validate (/home/docker/.npm-global/lib/node_modules/@finos/git-proxy/src/config/file.js:16:32)
    at Object.<anonymous> (/home/docker/.npm-global/lib/node_modules/@finos/git-proxy/index.js:39:8)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'proxy.config.json'
}

Node.js v20.15.1

To Reproduce Steps to reproduce the behavior:

  1. Run npm install -g @finos/[email protected] or run npm pack && npm install -g ./finos-git-proxy-1.3.2.tar.gz to install from source.
  2. Execute git-proxy with no arguments.

Expected behavior Git Proxy starts with all the default loaded values from proxy.config.json that we ship with the package itself.

coopernetes avatar Jul 19 '24 17:07 coopernetes