Skip to content

Commit

Permalink
added environment variable containing validation properties, changed …
Browse files Browse the repository at this point in the history
…base docker image, updated readme
  • Loading branch information
Mateusz Połeć committed Dec 21, 2018
1 parent 8d3827a commit 4497884
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ Easiest way to run Judge D wherever you need is by using Docker - image is avail

Of course you can use jar file generated during installation as well and deploy it on some application server like Tomcat.

## Validation

Validation behaviour can be modified using one of the options listed [here](https://bitbucket.org/atlassian/swagger-request-validator/src/0dff457f9ea7614d606ae8475d65cfe950570031/swagger-request-validator-core/README.md?fileviewer=file-view-default).
If you want to run the application using docker container, you can pass environment variable `VALIDATION_OPTIONS` with comma-separated validation properties.

Below setting causes changing default validation level to IGNORE and emission of validation error `validation.schema.required` at ERROR level.
```
VALIDATION_OPTIONS=defaultLevel=IGNORE,validation.schema.required=ERROR,
```

See more about validation behaviours and levels [here](https://bitbucket.org/atlassian/swagger-request-validator/src/0dff457f9ea7614d606ae8475d65cfe950570031/swagger-request-validator-core/README.md?fileviewer=file-view-default).

## Built With

* [Maven](https://maven.apache.org/) - Dependency Management
Expand Down
4 changes: 1 addition & 3 deletions judge-d-server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM openjdk:8-jdk-alpine


FROM openjdk:8-jdk

WORKDIR /root
ADD ./judge-d-server-0.1-SNAPSHOT.jar /root/judge-d.jar
Expand Down
25 changes: 18 additions & 7 deletions judge-d-server/src/main/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/bin/sh
java \
-XX:+UnlockExperimentalVMOptions \
-XX:+UseCGroupMemoryLimitForHeap \
-XX:MaxRAMFraction=2 \
-XshowSettings:vm \
$* -jar judge-d.jar
#!/bin/bash

MEMORY_OPTIONS=" -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2 -XshowSettings:vm "
JAVA_OPTIONS=$MEMORY_OPTIONS

if [[ -v VALIDATION_OPTIONS ]]; then
echo "Selected validation options: $VALIDATION_OPTIONS"
validation_options_array=(${VALIDATION_OPTIONS//,/ })
validation_options_array_length=${#validation_options_array[@]}
for (( i=0; i<${validation_options_array_length}; i++ ));
do
validation_options_array[$i]="-Dswagger."${validation_options_array[$i]}
JAVA_OPTIONS+="${validation_options_array[$i]} "
done
fi

echo $JAVA_OPTIONS
java $JAVA_OPTIONS $* -jar judge-d.jar

0 comments on commit 4497884

Please sign in to comment.