Skip to content

Commit

Permalink
Merge pull request openhab#332 from hakan42/330-inject-port-numbers
Browse files Browse the repository at this point in the history
Fixes openhab#330: Allow port number injection via environment variables
  • Loading branch information
kaikreuzer committed Aug 10, 2015
2 parents e7a87f1 + 59c188c commit 36cbdbe
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
18 changes: 17 additions & 1 deletion distribution/openhabhome/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
set ECLIPSEHOME="runtime/server"

:: set ports for HTTP(S) server
:check_http_port
IF NOT [%OPENHAB_HTTP_PORT%] == [] GOTO :http_port_set
set HTTP_PORT=8080
goto :check_https_port

:http_port_set
set HTTP_PORT=%OPENHAB_HTTP_PORT%
goto :check_https_port

:check_https_port
IF NOT [%OPENHAB_HTTPS_PORT%] == [] GOTO :https_port_set
set HTTPS_PORT=8443

goto :check_path

:https_port_set
set HTTPS_PORT=%OPENHAB_HTTPS_PORT%
goto :check_path

:: get path to equinox jar inside ECLIPSEHOME folder
:check_path
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

IF NOT [%EQUINOXJAR%] == [] GOTO :Launch
Expand Down
15 changes: 13 additions & 2 deletions distribution/openhabhome/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ cd `dirname $0`
eclipsehome="runtime/server";

# set ports for HTTP(S) server
HTTP_PORT=8080
HTTPS_PORT=8443
if [ ! -z ${OPENHAB_HTTP_PORT} ]
then
HTTP_PORT=${OPENHAB_HTTP_PORT}
else
HTTP_PORT=8080
fi

if [ ! -z ${OPENHAB_HTTPS_PORT} ]
then
HTTPS_PORT=${OPENHAB_HTTPS_PORT}
else
HTTPS_PORT=8443
fi

# get path to equinox jar inside $eclipsehome folder
cp=$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);
Expand Down
16 changes: 16 additions & 0 deletions distribution/openhabhome/start_debug.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
set ECLIPSEHOME="runtime/server"

:: set ports for HTTP(S) server
:check_http_port
IF NOT [%OPENHAB_HTTP_PORT%] == [] GOTO :http_port_set
set HTTP_PORT=8080
goto :check_https_port

:http_port_set
set HTTP_PORT=%OPENHAB_HTTP_PORT%
goto :check_https_port

:check_https_port
IF NOT [%OPENHAB_HTTPS_PORT%] == [] GOTO :https_port_set
set HTTPS_PORT=8443
goto :check_path

:https_port_set
set HTTPS_PORT=%OPENHAB_HTTPS_PORT%
goto :check_path

:: get path to equinox jar inside ECLIPSEHOME folder
:check_path
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

IF NOT [%EQUINOXJAR%] == [] GOTO :Launch
Expand Down
15 changes: 13 additions & 2 deletions distribution/openhabhome/start_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ cd `dirname $0`
eclipsehome="runtime/server";

# set ports for HTTP(S) server
HTTP_PORT=8080
HTTPS_PORT=8443
if [ ! -z ${OPENHAB_HTTP_PORT} ]
then
HTTP_PORT=${OPENHAB_HTTP_PORT}
else
HTTP_PORT=8080
fi

if [ ! -z ${OPENHAB_HTTPS_PORT} ]
then
HTTPS_PORT=${OPENHAB_HTTPS_PORT}
else
HTTPS_PORT=8443
fi

# get path to equinox jar inside $eclipsehome folder
cp=$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);
Expand Down

0 comments on commit 36cbdbe

Please sign in to comment.