https://kotlinlang.org logo
#spring
Title
d

Dsittel

09/29/2020, 7:23 AM
hi guys i need to set based on a profile a environment variable (here https_proxy) for local development. any best practise for it ? (my idea so far is to set it within a @Configuration in the init block with ProcessBuilder, but no luck so far 😞 )
t

Tobias Berger

09/29/2020, 7:44 AM
if you only need it for local development and not for production, I suggest just customizing your run configuration and setting the environmelt variable from outside.
d

Dsittel

09/29/2020, 7:45 AM
hi tobias, yeah sure we only need it for local development. can i "pin" https_proxy within application yaml on a specific profile ?
t

Tobias Berger

09/29/2020, 7:48 AM
if you can set it it your application yaml you can just add a profile specific configuration. E.g. you can add a file called
application-local-proxy.yml
and configure your profile there. Now whenever the profile
local-proxy
is active, that config will be loaded (in addition to the default config file)
d

Dsittel

09/29/2020, 7:50 AM
my profile is called "remote" so i am calling it application-remote.yaml. (it need exactly this syntax i guess ? )
t

Tobias Berger

09/29/2020, 7:51 AM
yes, it's just
application-<profile>.yml
🙌 1
file type doesn't matter of course.
and just a hint that people often forget: you can use mutliple profiles simutlaneously.
d

Dsittel

09/29/2020, 7:52 AM
yeah thx we are doing this all the time
i was not aware of this application-<profile> really nice hint
so i ve set within application-remote a variable called proxy: ${HTTPS_PROXY:url}
hmm does not work 😞
2 Views