nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.3k stars 132 forks source link

Inability to set a boolean value in config.ops #1389

Closed zeroecco closed 2 years ago

zeroecco commented 2 years ago

Summary

When try to set a boolean flag in config.ops, the JSON object refuses to parse. the error I am getting is: Error: failed converting configuration file: json: cannot unmarshal bool into Go struct field Config.Args of type string

zeroecco commented 2 years ago
"Args": [
    "--indexer",
    false
  ]
eyberg commented 2 years ago

you need to set that as a string, "false" - lmk if that works for you

zeroecco commented 2 years ago

the config.ops will compile and run. The application I am using only accepts a bool. Is there a way to use non-string cli flag options? I also tried "Env": { "INDEXER": false }

to no avail

eyberg commented 2 years ago

there is no bool type in bash (not that this is running bash) but you should be able to pass a string - we don't quote it

eyberg commented 2 years ago

for instance if you show the debug output this is what it transforms to:

➜  t cat config.json
{
  "Args": ["--indexer", "false"]
}

notice no quotes =>

➜  t ops run -c config.json -v --show-debug t
Manifest:
        &{root:map[arguments:[t --indexer false]

if this isn't working for you you are probably hitting a different issue

zeroecco commented 2 years ago

Understood! I will close this as PEBKAC