nanovms / ops

ops - build and run nanos unikernels

Home Page:https://ops.city

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inability to set a boolean value in config.ops

zeroecco opened this issue · comments

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

"Args": [
    "--indexer",
    false
  ]

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

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

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

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

Understood! I will close this as PEBKAC