DataDog / helm-charts

Helm charts for Datadog products
Apache License 2.0
341 stars 1.01k forks source link

synthetics-private-location - How to pass in configFile #110

Open jseiser opened 3 years ago

jseiser commented 3 years ago

Describe what happened:

Generated the configuration from the DD website. Attempted to pass the config in directly using

configFile: "{}"

I pasted it exactly as it was presented, I then swapped the " to ', and then I totally removed the ". All of them results in some form of..

Unexpected token d in JSON at position 2

/home/dog/node_modules/yargs/yargs.js:1178 if (parseErrors) throw new YError(parseErrors.message || parseErrors) ^ YError: Unexpected token d in JSON at position 2 at Object.runValidation [as _runValidation] (/home/dog/node_modules/yargs/yargs.js:1178:28) at Object.runCommand (/home/dog/node_modules/yargs/lib/command.js:226:36) at Object.parseArgs [as _parseArgs] (/home/dog/node_modules/yargs/yargs.js:1095:28) at Object.parse (/home/dog/node_modules/yargs/yargs.js:573:25) at getConfigFromArgs (/home/dog/dist/config/config.js:15:38) at Object. (/home/dog/dist/config/config.js:28:27) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) [dumb-init] Received signal 17. [dumb-init] A child with PID 10 exited with exit status 1. [dumb-init] Forwarded signal 15 to children. [dumb-init] Child exited with status 1. Goodbye.

What should this look like?

m-rousse commented 3 years ago

Hi, you can set the file in the Values.yaml with " and \ escaped (eg. using sed -E 's/([\\"])/\\\1/g'), like:

configFile: "{
  \"locationID\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",
  \"site\": \"datadoghq.com\",
  \"datadogApiKey\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",
  \"accessKey\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",
  \"secretAccessKey\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",
  \"privateKey\": \"-----BEGIN RSA PRIVATE KEY-----\\nMII(...)\\n-----END RSA PRIVATE KEY-----\",
  \"publicKey\": {
    \"pem\": \"-----BEGIN PUBLIC KEY-----\\nMII(...)==\\n-----END PUBLIC KEY-----\\n\",
    \"fingerprint\": \"sha256$base64$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=\"
  }
}"

Or directly using the pipe syntax which does not need any reformating, ie:

configFile: |
  {
    "locationID": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "site": "datadoghq.com",
    "datadogApiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "accessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "secretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nMII(...)\n-----END RSA PRIVATE KEY-----",
    "publicKey": {
      "pem": "-----BEGIN PUBLIC KEY-----\nMII(...)==\n-----END PUBLIC KEY-----\n",
      "fingerprint": "sha256$base64$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
  }