deltaDAO / self-description-signer

A simple script to create Gaia-X Self Descriptions
6 stars 6 forks source link

[BUG] Problem with command line parsing #20

Open kettenbach-it opened 1 year ago

kettenbach-it commented 1 year ago

Summary

I want to supply the name of the file containing my self description as a command line parameter. From the index.js I see, that this is supposed to work as third parameter.

I keep the program in a unmodified subdirectory self-description-signer (created by git submodule add) - all files that I work with are outside of this git repo.

My config therefore is in ./config (outside of self-description-signer)

Current Behavior

I call this command:

❯ node self-description-signer/index.js ./participant-self-description.json
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './participant-self-description.json'
Require stack:
- /Users/volker/Huawei/Boot-X/boot-x-iac/Self Description Signing/self-description-signer/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/volker/Huawei/Boot-X/boot-x-iac/Self Description Signing/self-description-signer/index.js:10:25)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/volker/Huawei/Boot-X/boot-x-iac/Self Description Signing/self-description-signer/index.js'
  ]
}

and get an error. The same with node self-description-signer/index.js participant-self-description.json or with node self-description-signer/index.js $PWD/participant-self-description.json

Expected Behavior

I would expect my file ./participant-self-description.json to be signed. Strangely, if I leave out the third parameter, it will sign the example in self-description-signer/config and put the output to output

Steps to Reproduce

Enter the above commands.

Environment

❯ node -v
v16.13.0

Anything else