What is the best way to know if sync mode is enabl...
# 🤖|ask-kapa
m
Please stand by @big-solstice-45894 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- To determine if sync mode is enabled, you can use string templating or Bonsai's
${actions.deploy.<name>.mode}
template string. If referenced in the action itself, you can use
${this.mode}
, but this would not be backward compatible with version 0.12. Here is an example config that works with both Bonsai and 0.12:
Copy code
yaml
variables: 
  sync-mode: ${command.params contains 'sync' && (command.params.sync contains 'api' || isEmpty(command.params.sync))}
  dev-mode: ${command.name == 'dev' || (command.params contains 'dev-mode' && (command.params.dev-mode contains 'api' || isEmpty(command.params.dev-mode)))}
In this block, the variables
sync-mode
or
dev-mode
are set to true if the relative mode is requested for the
api
service/deploy. Sync mode or dev mode have been requested if either
var.sync-mode
or
var.dev-mode
are true. You can use a template expression like
${var.sync-mode || var.dev-mode ? 'yes' : 'no'}
to change the behaviour of your actions or modules. For more details, you can refer to the Garden documentation (). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------