Skip to content

Commit

Permalink
Validate FLYWAY_EDITION in CLI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
DoodleBobBuffPants committed Nov 5, 2020
1 parent 279e6a4 commit f3a6544
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions flyway-commandline/src/main/assembly/flyway
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ set -- "${POSITIONAL[@]}"
if [ -z "$FLYWAY_EDITION" ]; then
FLYWAY_EDITION=community
fi
if [ "$FLYWAY_EDITION" == "teams" ]; then
FLYWAY_EDITION=enterprise
fi

if ! [[ "$FLYWAY_EDITION" =~ ^(community|pro|enterprise|teams|\[edition\])$ ]]; then
echo invalid edition \"$FLYWAY_EDITION\"
exit 1
fi

CP="$INSTALLDIR/lib/*:$INSTALLDIR/lib/$FLYWAY_EDITION/*:$INSTALLDIR/drivers/*"

Expand Down
17 changes: 17 additions & 0 deletions flyway-commandline/src/main/assembly/flyway.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ IF NOT [%1]==[] (
if "%FLYWAY_EDITION%"=="" (
set FLYWAY_EDITION=community
)
if "%FLYWAY_EDITION%"=="teams" (
set FLYWAY_EDITION=enterprise
)

@REM Validate the Flyway edition
set editionValid=false
for %%E in ("community" "pro" "enterprise" "teams" "community") do (
if "%FLYWAY_EDITION%"==%%E (
set editionValid=true
)
)
if %editionValid%==false (
@Echo on
echo invalid edition "%FLYWAY_EDITION%"
@Echo off
EXIT /B 1
)

%JAVA_CMD% -Djava.library.path="%INSTALLDIR%\native" %JAVA_ARGS% -cp "%CLASSPATH%;%INSTALLDIR%\lib\*;%INSTALLDIR%\lib\%FLYWAY_EDITION%\*;%INSTALLDIR%\drivers\*" org.flywaydb.commandline.Main %*

Expand Down

0 comments on commit f3a6544

Please sign in to comment.