Accessing secret env variables during build step

[variables]
GOPRIVATE="github.com/stroomnetwork"
STROOM_REPOS_ACCESS_KEY="ghp_THIS is Secret, so I can't put it here, but it works if I do"

[phases.install]
aptPkgs = ['...', 'unzip', 'wget', 'jq']
paths = ['~/go/bin', '/usr/local/bin']

cmds = [
# to support private repo imports
'git config --global url.https://${STROOM_REPOS_ACCESS_KEY}@github.com/.insteadOf https://github.com/',
'...',
'make setup'
]
[variables]
GOPRIVATE="github.com/stroomnetwork"
STROOM_REPOS_ACCESS_KEY="ghp_THIS is Secret, so I can't put it here, but it works if I do"

[phases.install]
aptPkgs = ['...', 'unzip', 'wget', 'jq']
paths = ['~/go/bin', '/usr/local/bin']

cmds = [
# to support private repo imports
'git config --global url.https://${STROOM_REPOS_ACCESS_KEY}@github.com/.insteadOf https://github.com/',
'...',
'make setup'
]
I need to pass STROOM_REPOS_ACCESS_KEY into a build step, but it's not defined unless I put it plaintext into nixpacks.toml. However, I don't want to commit this value either
24 Replies
Percy
Percy10mo ago
Project ID: fdd52bdc-3766-40b0-9727-44e1356a5da3
caffeinum
caffeinum10mo ago
fdd52bdc-3766-40b0-9727-44e1356a5da3
Brody
Brody10mo ago
have you tried putting it in the service variables?
caffeinum
caffeinum10mo ago
do you mean [variables] section in nixpacks?
Brody
Brody10mo ago
I mean the variables section of the railway service
caffeinum
caffeinum10mo ago
what about locally though? i guess you're right, and that's not a railway feedback, more of a nixpacks feedback
Brody
Brody10mo ago
you use railway run locally still isn't feedback, these are purely questions
caffeinum
caffeinum10mo ago
so you're saying it's not possible to pass a variable into nixpacks build without exposing it plaintext in the nixpacks.toml?
Brody
Brody10mo ago
never said that
caffeinum
caffeinum10mo ago
how do i do that?
Brody
Brody10mo ago
you want to put that variable in the service variables use the service variables
caffeinum
caffeinum10mo ago
yeah, you said that
caffeinum
caffeinum10mo ago
this works on railway, but not locally
Brody
Brody10mo ago
^
caffeinum
caffeinum10mo ago
yes, i tried that now
Brody
Brody10mo ago
or you just login with github locally and you'd be authorised
caffeinum
caffeinum10mo ago
what command do you propose to do w/ railway run? i thought you meant railway run nixpacks build .
caffeinum
caffeinum10mo ago
A block has been shared!
railway run nixpacks build . ### ╔═════════════════════�...
caffeinum
caffeinum10mo ago
it doesn't work either
Brody
Brody10mo ago
whatever command needs that github token
caffeinum
caffeinum10mo ago
mm this doesn't really make sense
Brody
Brody10mo ago
I'm not sure what's confusing here so let's only focus on getting this working on railway have you placed your github token in the service variables yet
caffeinum
caffeinum10mo ago
yes, it works on railway, but i also want to be able to build the same image for testing locally the original problem is mostly fixed now, so i will close the issue but it's still not clear to me why it's not possible