HI everyone,
It is possible to set up environment variables for a timer? Something like
timers:
crontest:
command: /bin/command
environment:
- FOO=BAR
- FOO1=BAR1
schedule: "2 * * * ? *"
service: java
HI everyone,
It is possible to set up environment variables for a timer? Something like
timers:
crontest:
command: /bin/command
environment:
- FOO=BAR
- FOO1=BAR1
schedule: "2 * * * ? *"
service: java
You would set the environment variables on the service that you specify in the timer. Something like:
services:
timers:
build: ./timers
environment:
- FOO=BAR
- FOO1=BAR1
scale: 0
timers:
cleanup:
command: bin/cleanup
schedule: "*/1 * * * ?"
service: timers
Hope that makes sense!
Hey @scastro, did you get it to work?
@ed_convox if I don’t want to hard code the environment in the convox.yml
(my use case is the credentials for a production mysqldump) is there a way to set the environment in the secrets like for app level secrets?
Sure, my config there was just an example!
services:
timers:
build: ./timers
environment:
- FOO
- FOO1
scale: 0
timers:
cleanup:
command: bin/cleanup
schedule: "*/1 * * * ?"
service: timers
and then
$ convox env set FOO=BAR FOO1=BAR1
is equally valid!
Ok, so if in services I have timers and web like this:
services:
web:
build: .
command: bin/webserver
environment:
- FOO
- FOO1
timers:
build: ./timers
environment:
- FOO
- FOO1
scale: 0
timers:
cleanup:
command: bin/cleanup
schedule: "*/1 * * * ?"
service: timers
doing $ convox env set FOO=BAR FOO1=BAR1
the secrets will work for both web and timers correct?