Skip to content

Commit

Permalink
Use @ConfigProperties instead of @ConfigMappings
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Sep 14, 2021
1 parent cdf7343 commit d863586
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 48 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<openapi.version>2.0</openapi.version>
<prometheus.version>0.9.0</prometheus.version>
<protobuf.version>3.17.3</protobuf.version>
<quarkus.version>2.2.1.Final</quarkus.version>
<quarkus.version>2.2.3.Final</quarkus.version>
<reactor.version>2020.0.10</reactor.version>
<rocksdb.version>6.22.1.1</rocksdb.version>
<scala2.12.version>2.12.13</scala2.12.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@
*/
package org.projectnessie.server.config;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import io.quarkus.arc.config.ConfigProperties;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.projectnessie.versioned.dynamodb.DynamoStoreConfig;

/** DynamoDB version store configuration. */
@ConfigMapping(prefix = "nessie.version.store.dynamo")
@ConfigProperties(prefix = "nessie.version.store.dynamo")
public interface DynamoVersionStoreConfig {

@WithName("initialize")
@WithDefault("false")
@ConfigProperty(name = "initialize", defaultValue = "false")
boolean isDynamoInitialize();

@WithName("table-prefix")
@WithDefault(DynamoStoreConfig.TABLE_PREFIX)
@ConfigProperty(defaultValue = DynamoStoreConfig.TABLE_PREFIX)
String getTablePrefix();

@WithName("tracing")
@WithDefault("true")
@ConfigProperty(name = "tracing", defaultValue = "true")
boolean enableTracing();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@
*/
package org.projectnessie.server.config;

import io.quarkus.arc.config.ConfigProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import java.util.Optional;
import org.eclipse.microprofile.config.inject.ConfigProperty;

/** JGit version store configuration. */
@ConfigMapping(prefix = "nessie.version.store.jgit")
@ConfigProperties(prefix = "nessie.version.store.jgit")
public interface JGitVersionStoreConfig {
@RegisterForReflection
public enum JGitStoreType {
DISK,
INMEMORY
}

@WithName("type")
@WithDefault("INMEMORY")
@ConfigProperty(name = "type", defaultValue = "INMEMORY")
JGitStoreType getJgitStoreType();

@WithName("directory")
@ConfigProperty(name = "directory")
Optional<String> getJgitDirectory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
*/
package org.projectnessie.server.config;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import io.quarkus.arc.config.ConfigProperties;
import org.eclipse.microprofile.config.inject.ConfigProperty;

/** Configuration for Nessie authentication settings. */
@ConfigMapping(prefix = "nessie.server.authentication")
@ConfigProperties(prefix = "nessie.server.authentication")
public interface QuarkusNessieAuthenticationConfig {

/** Returns {@code true} if Nessie authentication is enabled. */
@WithName("enabled")
@WithDefault("false")
@ConfigProperty(name = "enabled", defaultValue = "false")
boolean enabled();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@
*/
package org.projectnessie.server.config;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import io.quarkus.arc.config.ConfigProperties;
import java.util.Map;
import org.eclipse.microprofile.config.inject.ConfigProperty;

/** Configuration for Nessie authorization settings. */
@ConfigMapping(prefix = "nessie.server.authorization")
@ConfigProperties(prefix = "nessie.server.authorization")
public interface QuarkusNessieAuthorizationConfig {

/**
* Returns {@code true} if Nessie authorization is enabled.
*
* @return {@code true} if Nessie authorization is enabled.
*/
@WithName("enabled")
@WithDefault("false")
@ConfigProperty(name = "enabled", defaultValue = "false")
boolean enabled();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,19 @@
*/
package org.projectnessie.server.config;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import io.quarkus.arc.config.ConfigProperties;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.projectnessie.services.config.ServerConfig;

/** Nessie server config for Quarkus. */
@ConfigMapping(prefix = "nessie.server")
@ConfigProperties(prefix = "nessie.server")
public interface QuarkusServerConfig extends ServerConfig {

@ConfigProperty(name = "default-branch", defaultValue = "main")
@Override
@WithName("default-branch")
@WithDefault("main")
String getDefaultBranch();

@ConfigProperty(name = "send-stacktrace-to-client", defaultValue = "false")
@Override
@WithName("send-stacktrace-to-client")
@WithDefault("false")
boolean sendStacktraceToClient();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
*/
package org.projectnessie.server.config;

import io.quarkus.arc.config.ConfigProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;
import org.eclipse.microprofile.config.inject.ConfigProperty;

/** Version store configuration. */
@ConfigMapping(prefix = "nessie.version.store")
@ConfigProperties(prefix = "nessie.version.store")
public interface VersionStoreConfig {

@RegisterForReflection
Expand All @@ -31,20 +30,17 @@ public enum VersionStoreType {
JGIT
}

@WithName("type")
@WithDefault("INMEMORY")
@ConfigProperty(name = "type", defaultValue = "INMEMORY")
VersionStoreType getVersionStoreType();

/**
* Whether calls against the version-store are traced with OpenTracing/OpenTelemetry (Jaeger),
* enabled by default.
*/
@WithName("trace.enable")
@WithDefault("true")
@ConfigProperty(name = "trace.enable", defaultValue = "true")
boolean isTracingEnabled();

/** Whether metrics for the version-store are enabled (enabled by default). */
@WithName("metrics.enable")
@WithDefault("true")
@ConfigProperty(name = "metrics.enable", defaultValue = "true")
boolean isMetricsEnabled();
}

0 comments on commit d863586

Please sign in to comment.