How to use env variables within config.json #8393
Answered
by
mhubig
mhubig
asked this question in
Request Help
-
Hi there, I'm new to renovate and I'm wondering if there is a best practice / recommended way to use secrets exposed as environment variables within the renovate I'm using renovate as a k8s cronjob an so I usually expose secrets to the cronjob pod like so: env:
- name: ARTIFACTORY_PASSWORD
valueFrom:
secretKeyRef:
name: renovate-secrets
key: ARTIFACTORY_PASSWORD Now I like to inject those variables into my {
"dryRun": true,
"logLevel": "debug",
"platform": "gitlab",
"token": "${GITLAB_TOKEN}",
"endpoint": "https://my.gitlab.com/api/v4",
"gitAuthor": "Renovate Bot <[email protected]>",
"autodiscover": true,
"autodiscoverFilter": "apps/**",
"npmrc": "@dm:registry=my.artifactory.com/api/npm/repo-my\n//my.artifactory.com/api/npm/:_authToken=${NPM_TOKEN}",
"hostRules": [
{
"platform": "maven",
"endpoint": "https://my.artifactory.com",
"username": "${ARTIFACTORY_USERNAME}",
"password": "${ARTIFACTORY_PASSWORD}"
}
]
} Is there any way of doing this? |
Beta Was this translation helpful? Give feedback.
Answered by
mhubig
Jan 22, 2021
Replies: 2 comments 3 replies
-
It's impossible with a JSON file. Use config.ha instead so you can access |
Beta Was this translation helpful? Give feedback.
1 reply
-
So the js equivalent of my module.exports = {
dryRun: true,
logLevel: "debug",
platform: "gitlab",
token: `${process.env.GITLAB_TOKEN}`,
endpoint: "https://my.gitlab.com/api/v4",
gitAuthor: "Renovate Bot <[email protected]>",
autodiscover: true,
autodiscoverFilter: "apps/**",
npmrc: `@dm:registry=my.artifactory.com/api/npm/repo-my\n//my.artifactory.com/api/npm/:_authToken=${process.env.NPM_TOKEN}`,
hostRules: [
{
"platform": "maven",
"endpoint": "https://my.artifactory.com",
"username": `${process.env.ARTIFACTORY_USERNAME}`,
"password": `${process.env.ARTIFACTORY_PASSWORD}`
}
]
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
viceice
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So the js equivalent of my
config.json
file would be something like this?