Is it possible to pass command line arguments to a Spring boot app on Azure via the web.config file? Our app is up and running but we need to set the:
--spring.profiles.active=local
at startup.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="ack=t-Djava.net.preferIPv4Strue -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\myjar-0.0.1.jar"">
</httpPlatform>
</system.webServer>
</configuration>
I got a response from Microsoft and they had two ways:
Add "environmentVariables" block to the xml above:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\AssetCommander-0.0.1.jar"">
<environmentVariables>
<environmentVariable name="JAVA_OPTS" value="-Dspring.profiles.active=dev" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
[
3, Actually, neither of those worked for us. We had to do this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dspring.profiles.active=%spring.profiles.active% -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\AssetCommander-0.0.1.jar"">
</httpPlatform>
</system.webServer>
</configuration>
AND #2 above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.