Skip to content

Noob #1346

Answered by runeimp
dodalovic asked this question in Q&A
Noob #1346
Sep 17, 2022 · 5 comments · 2 replies
Discussion options

You must be logged in to vote

There is one major problem with your code. env is only defined for the tunnel recipe. It doesn't exist in the global context of the Justfile. So your if statements need to reside in the the tunnel recipe somehow. You could do a shebang recipe like

default:
	@just --list

tunnel env:
	#!/bin/sh

	dbHost={{ if env == "dev" { "XXXX.rds.amazonaws.com" } else if env == "staging" { "YYYY.rds.amazonaws.com" } else if env == "prod" { "ZZZZ.rds.amazonaws.com" } else { error("env not supported") } }}
	bastionHost={{ if env == "dev" { "111.111.111.111" } else if env == "staging" { "222.111.111.111" } else if env == "prod" { "333.111.111.111" } else { error("env not supported") } }}

	echo ssh -i ~/.…

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@dodalovic
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@casey
Comment options

Answer selected by casey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants