guild icon
Toit
#Passing arguments to a program (`jag watch` with defines)
Thread channel in help
bpmct
bpmct 05/25/2025 12:26 AM
I am hoping to pass arguments (key/value pairs) to my application for it to respect at runtime. I'm a bit confused.

- Testing (jaguar): defines can be passed on jag run: https://github.com/toitlang/jaguar?tab=readme-ov-file#defines
- Development (jaguar):assets (file) is passed on jag watch for development (I guess I need to encode this as tison (https://libs.toit.io/encoding/tison/library-summary)
- Production (Artemis)arguments are passed in the spec: https://toit.io/schemas/artemis/pod-specification/v1.json

Am I understanding this right? It feels a bit fragmented so I was wondering if you had tips, in particular, on how this can easily be done with local development (jag watch) without hardcoding stuff.
bitphlipphar
bitphlipphar 05/25/2025 05:55 AM
Yeah. It is a bit fragmented. We sometimes end up doing a runtime check to see if we're running on Artemis and fetch the arguments in two different ways. Maybe there is a way to unify this more at the base layer or maybe we should add a support package to at least make it convenient for programs.
bpmct
bpmct 05/25/2025 04:25 PM
Gotcha! No worries, I just wanted to make sure I wasn't missing anything obvious
3 messages in total