Skip to content

Default config not loaded due to excessive validation #654

Open
@coopernetes

Description

@coopernetes

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 f9c456d

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions