diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml
new file mode 100644
index 0000000..1962054
--- /dev/null
+++ b/.github/workflows/build-docker.yml
@@ -0,0 +1,31 @@
+name: build-docker
+on:
+ push:
+ branches:
+ - 'main'
+ - 'develop'
+ tags:
+ - '*'
+jobs:
+ publish-docker:
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: Login to Docker Registry
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Build nad push
+ uses: docker/build-push-action@v3
+ with:
+ context: ./
+ file: ./Dockerfile
+ push: true
+ tags: ghcr.io/datagov-cz/isds-adapter:${{ github.ref_name }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..97cd0ec
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,8 @@
+FROM openjdk:21-slim-bookworm as build
+WORKDIR /opt/isds-adapter/
+COPY ./ ./
+
+RUN chmod u+x ./mvnw && ./mvnw package
+
+FROM openjdk:21-slim-bookworm
+COPY --from=build /opt/isds-adapter/dist /opt/isds-adapter/
diff --git a/README.md b/README.md
index 6675c57..afe6ae5 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,7 @@ Ignore any message older than one day.
For documentation about ISIS see [Poradna ISDS](https://www.poradnaisds.cz/) or [Provozní řád ISDS](https://info.mojedatovaschranka.cz/info/cs/80.html).
## Requirements
- * Java 16
- * Maven
+ * Java 21
* git client
## Install from source
@@ -14,13 +13,13 @@ Clone this repository and use maven to build the program.
```
git clone https://github.com/opendata-mvcr/nkod-isds.git
cd nkod-isds
-mvn install
+mvnw package
```
result of the build is saved into ```dist``` directory.
Update configuration file ```dist/configuration.properties```.
```
cd dist
-java -DconfigurationFile=./configuration.properties -jar isds-0.0.0.jar
+java -DconfigurationFile=./configuration.properties -jar isds-adapter.jar
```
You may need to remove certificates in ```dist/certificates``` and download valid production/test certificate.
@@ -52,5 +51,12 @@ If either of the conditions does not hold, an _ignore_ entry is created, and the
Otherwise, an _accept_ record for the message is created, the first `.txt` attachment
is downloaded, and the message is _markMessageAsDownloaded_ in the ISDS.
+## Environment properties
+Configuration from the configuration file can be overwritten using environment variables.
+Program support following environment properties:
+- ISDS_LOGIN - replace `login`.
+- ISDS_PASSWORD - replace `password`.
+- ISDS_URL - replace `url`.
+
Tento repozitář je udržován v rámci projektu OPZ č. CZ.03.4.74/0.0/0.0/15_025/0013983.
![Evropská unie - Evropský sociální fond - Operační program Zaměstnanost](https://data.gov.cz/images/ozp_logo_cz.jpg)
diff --git a/pom.xml b/pom.xml
index 98033e8..104cc69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,9 +92,7 @@
true
lib/
-
- cz.gov.data.isds.AppEntry
-
+ cz.gov.data.isds.AppEntry
diff --git a/src/main/java/cz/gov/data/isds/Configuration.java b/src/main/java/cz/gov/data/isds/Configuration.java
index 5e7dfdf..7ffe416 100644
--- a/src/main/java/cz/gov/data/isds/Configuration.java
+++ b/src/main/java/cz/gov/data/isds/Configuration.java
@@ -43,9 +43,10 @@ private void loadFromFile(File file) throws IOException {
properties.load(stream);
}
//
- this.login = getProperty(properties, "login");
- this.password = getProperty(properties, "password");
- this.url = getProperty(properties, "url");
+ this.login = getEnvOrProperty(properties, "login", "ISDS_LOGIN");
+ this.password = getEnvOrProperty(properties, "password", "ISDS_PASSWORD");
+ this.url = getEnvOrProperty(properties, "url", "ISDS_URL");
+ //
this.outputMessages = getProperty(properties, "output.messages");
this.outputAttachments = getProperty(properties, "output.attachments");
this.certificatesDirectory = getProperty(properties, "certificates");
@@ -53,6 +54,15 @@ private void loadFromFile(File file) throws IOException {
getProperty(properties, "download_interval_in_minutes"));
}
+ private String getEnvOrProperty(
+ Properties properties, String property, String environment) {
+ String environmentValue = System.getenv(environment);
+ if (environmentValue != null) {
+ return environmentValue;
+ }
+ return getProperty(properties, property);
+ }
+
private String getProperty(Properties properties, String name) {
final String value;
try {