Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-add ConfigSourceFactory #20

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ public class HubConfig implements ConfigSource {

private static final Logger LOG = Logger.getLogger(HubConfig.class);
private static final String HUB_CONFIGSOURCE_NAME = "HubConfig";
private static final String HUB_CONFIGPATH_PROPERTY_KEY = "hub.config.path";

private final HubConfigPersistence persistence;
private final Properties config;

public HubConfig() {
var configPath = System.getProperty(HUB_CONFIGPATH_PROPERTY_KEY);
public HubConfig(String configPath) {
if (configPath == null) {
throw new IllegalStateException("Property " + HUB_CONFIGPATH_PROPERTY_KEY + " not set.");
throw new IllegalStateException("Hub config path not set.");
}

LOG.info("Hub config persists to " + configPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.cryptomator.hub.config;

import io.smallrye.config.ConfigSourceContext;
import io.smallrye.config.ConfigSourceFactory;
import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.List;

public class HubConfigSourceFactory implements ConfigSourceFactory {

private static final String HUBCONFIG_PROPERTY_KEY = "hub.config.path";

@Override
public Iterable<ConfigSource> getConfigSources(ConfigSourceContext configSourceContext) {
var configPath = configSourceContext.getValue(HUBCONFIG_PROPERTY_KEY);
var hubConfig = new HubConfig(configPath.getValue());
return List.of(hubConfig);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.cryptomator.hub.config.HubConfigSourceFactory

This file was deleted.

3 changes: 3 additions & 0 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ quarkus.http.port=9090
quarkus.oidc.application-type=service
quarkus.oidc.client-id=cryptomator-hub

hub.config.path=hub.properties
%test.hub.config.path=target/hub-test.properties

# Keycloak dev service
%dev.quarkus.keycloak.devservices.enabled=true
%dev.quarkus.keycloak.devservices.create-realm=false
Expand Down