Compare commits

...

2 Commits
3.0.0 ... 3.0.1

Author SHA1 Message Date
Athou
99130d0181 combine EnvironmentSubstitutor and SubstitutingSourceProvider (#1050) 2023-04-25 10:40:14 +02:00
Athou
90e2036cbe build for armv7 too 2023-04-25 10:24:22 +02:00
3 changed files with 21 additions and 2 deletions

View File

@@ -14,6 +14,13 @@ jobs:
with:
fetch-depth: 0
# Setup
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Java
uses: actions/setup-java@v3
with:
@@ -21,6 +28,7 @@ jobs:
distribution: "temurin"
cache: "maven"
# Build
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
@@ -42,6 +50,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm/v7
push: ${{ github.ref_type == 'tag' && matrix.java == '8' }}
tags: |
athou/commafeed:latest

View File

@@ -1,4 +1,4 @@
FROM openjdk:17-alpine
FROM eclipse-temurin:17-jre
RUN mkdir -p /commafeed/data
VOLUME /commafeed/data

View File

@@ -61,6 +61,8 @@ import be.tomcools.dropwizard.websocket.WebsocketBundle;
import io.dropwizard.Application;
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.configuration.DefaultConfigurationFactoryFactory;
import io.dropwizard.configuration.EnvironmentVariableSubstitutor;
import io.dropwizard.configuration.SubstitutingSourceProvider;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.forms.MultiPartBundle;
import io.dropwizard.hibernate.HibernateBundle;
@@ -96,7 +98,15 @@ public class CommaFeedApplication extends Application<CommaFeedConfiguration> {
return objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
}
});
bootstrap.setConfigurationSourceProvider(new EnvironmentSubstitutor("CF", bootstrap.getConfigurationSourceProvider()));
// enable config.yml string substitution
// e.g. having a custom config.yml file with app.session.path=${SOME_ENV_VAR} will substitute SOME_ENV_VAR
SubstitutingSourceProvider substitutingSourceProvider = new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false));
// enable config.yml properties override with env variables prefixed with CF_
// e.g. setting CF_APP_ALLOWREGISTRATIONS=true will set app.allowRegistrations to true
EnvironmentSubstitutor environmentSubstitutor = new EnvironmentSubstitutor("CF", substitutingSourceProvider);
bootstrap.setConfigurationSourceProvider(environmentSubstitutor);
bootstrap.getObjectMapper().registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.SECONDS, false));