forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all dist options to the new module
Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com>
- Loading branch information
Showing
35 changed files
with
985 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
config-api/src/main/java/org/keycloak/config/ClusteringOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.keycloak.config; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ClusteringOptions { | ||
|
||
public enum Mechanism { | ||
ispn, | ||
local | ||
} | ||
|
||
public static final Option CACHE = new OptionBuilder<>("cache", Mechanism.class) | ||
.category(OptionCategory.CLUSTERING) | ||
.description("Defines the cache mechanism for high-availability. " | ||
+ "By default, a 'ispn' cache is used to create a cluster between multiple server nodes. " | ||
+ "A 'local' cache disables clustering and is intended for development and testing purposes.") | ||
.defaultValue(Mechanism.ispn) | ||
.buildTime(true) | ||
.build(); | ||
|
||
public enum Stack { | ||
tcp, | ||
udp, | ||
kubernetes, | ||
ec2, | ||
azure, | ||
google; | ||
} | ||
|
||
public static final Option CACHE_STACK = new OptionBuilder<>("cache-stack", Stack.class) | ||
.category(OptionCategory.CLUSTERING) | ||
.description("Define the default stack to use for cluster communication and node discovery. This option only takes effect " | ||
+ "if 'cache' is set to 'ispn'. Default: udp.") | ||
.buildTime(true) | ||
.expectedValues(Stack.values()) | ||
.build(); | ||
|
||
public static final Option<File> CACHE_CONFIG_FILE = new OptionBuilder<>("cache-config-file", File.class) | ||
.category(OptionCategory.CLUSTERING) | ||
.description("Defines the file from which cache configuration should be loaded from. " | ||
+ "The configuration file is relative to the 'conf/' directory.") | ||
.buildTime(true) | ||
.build(); | ||
|
||
public static final List<Option<?>> ALL_OPTIONS = new ArrayList<>(); | ||
|
||
static { | ||
ALL_OPTIONS.add(CACHE); | ||
ALL_OPTIONS.add(CACHE_STACK); | ||
ALL_OPTIONS.add(CACHE_CONFIG_FILE); | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
config-api/src/main/java/org/keycloak/config/DatabaseOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package org.keycloak.config; | ||
|
||
import org.keycloak.config.database.Database; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class DatabaseOptions { | ||
|
||
public static final Option<String> DB_DIALECT = new OptionBuilder<>("db-dialect", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.runtimes(Option.Runtime.OPERATOR) | ||
.buildTime(true) | ||
.build(); | ||
|
||
public static final Option<String> DB_DRIVER = new OptionBuilder<>("db-driver", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.runtimes(Option.Runtime.OPERATOR) | ||
.defaultValue(Database.getDriver("dev-file", true).get()) | ||
.build(); | ||
|
||
public static final Option<Database.Vendor> DB = new OptionBuilder<>("db", Database.Vendor.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The database vendor. Possible values are: " + String.join(", ", Database.getAliases())) | ||
.expectedStringValues(Database.getAliases()) | ||
.buildTime(true) | ||
.build(); | ||
|
||
public static final Option<String> DB_URL = new OptionBuilder<>("db-url", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The full database JDBC URL. If not provided, a default URL is set based on the selected database vendor. " + | ||
"For instance, if using 'postgres', the default JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. ") | ||
.build(); | ||
|
||
public static final Option<String> DB_URL_HOST = new OptionBuilder<>("db-url-host", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("Sets the hostname of the default JDBC URL of the chosen vendor. If the `db-url` option is set, this option is ignored.") | ||
.build(); | ||
|
||
public static final Option<String> DB_URL_DATABASE = new OptionBuilder<>("db-url-database", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("Sets the database name of the default JDBC URL of the chosen vendor. If the `db-url` option is set, this option is ignored.") | ||
.build(); | ||
|
||
public static final Option<Integer> DB_URL_PORT = new OptionBuilder<>("db-url-port", Integer.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("Sets the port of the default JDBC URL of the chosen vendor. If the `db-url` option is set, this option is ignored.") | ||
.build(); | ||
|
||
public static final Option<String> DB_URL_PROPERTIES = new OptionBuilder<>("db-url-properties", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("Sets the properties of the default JDBC URL of the chosen vendor. If the `db-url` option is set, this option is ignored.") | ||
.build(); | ||
|
||
public static final Option<String> DB_USERNAME = new OptionBuilder<>("db-username", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The username of the database user.") | ||
.build(); | ||
|
||
public static final Option<String> DB_PASSWORD = new OptionBuilder<>("db-password", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The password of the database user.") | ||
.build(); | ||
|
||
public static final Option<String> DB_SCHEMA = new OptionBuilder<>("db-schema", String.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The database schema to be used.") | ||
.build(); | ||
|
||
public static final Option<Integer> DB_POOL_INITIAL_SIZE = new OptionBuilder<>("db-pool-initial-size", Integer.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The initial size of the connection pool.") | ||
.build(); | ||
|
||
public static final Option<Integer> DB_POOL_MIN_SIZE = new OptionBuilder<>("db-pool-min-size", Integer.class) | ||
.category(OptionCategory.DATABASE) | ||
.description("The minimal size of the connection pool.") | ||
.build(); | ||
|
||
public static final Option<Integer> DB_POOL_MAX_SIZE = new OptionBuilder<>("db-pool-max-size", Integer.class) | ||
.category(OptionCategory.DATABASE) | ||
.defaultValue(100) | ||
.description("The maximum size of the connection pool.") | ||
.build(); | ||
|
||
public static final List<Option<?>> ALL_OPTIONS = new ArrayList<>(); | ||
|
||
static { | ||
ALL_OPTIONS.add(DB_DIALECT); | ||
ALL_OPTIONS.add(DB_DRIVER); | ||
ALL_OPTIONS.add(DB); | ||
ALL_OPTIONS.add(DB_URL); | ||
ALL_OPTIONS.add(DB_URL_HOST); | ||
ALL_OPTIONS.add(DB_URL_DATABASE); | ||
ALL_OPTIONS.add(DB_URL_PORT); | ||
ALL_OPTIONS.add(DB_URL_PROPERTIES); | ||
ALL_OPTIONS.add(DB_USERNAME); | ||
ALL_OPTIONS.add(DB_PASSWORD); | ||
ALL_OPTIONS.add(DB_SCHEMA); | ||
ALL_OPTIONS.add(DB_POOL_INITIAL_SIZE); | ||
ALL_OPTIONS.add(DB_POOL_MIN_SIZE); | ||
ALL_OPTIONS.add(DB_POOL_MAX_SIZE); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
config-api/src/main/java/org/keycloak/config/FeatureOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.keycloak.config; | ||
|
||
import org.keycloak.common.Profile; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class FeatureOptions { | ||
|
||
public static final Option FEATURES = new OptionBuilder("features", List.class, Profile.Feature.class) | ||
.category(OptionCategory.FEATURE) | ||
.description("Enables a set of one or more features.") | ||
.expectedStringValues(getFeatureValues()) | ||
.buildTime(true) | ||
.build(); | ||
|
||
public static final Option FEATURES_DISABLED = new OptionBuilder("features-disabled", List.class, Profile.Feature.class) | ||
.category(OptionCategory.FEATURE) | ||
.description("Disables a set of one or more features.") | ||
.expectedStringValues(getFeatureValues()) | ||
.buildTime(true) | ||
.build(); | ||
|
||
private static List<String> getFeatureValues() { | ||
List<String> features = new ArrayList<>(); | ||
|
||
for (Profile.Feature value : Profile.Feature.values()) { | ||
features.add(value.name().toLowerCase().replace('_', '-')); | ||
} | ||
|
||
features.add(Profile.Type.PREVIEW.name().toLowerCase()); | ||
|
||
return features; | ||
} | ||
|
||
public static final List<Option<?>> ALL_OPTIONS = new ArrayList<>(); | ||
|
||
static { | ||
ALL_OPTIONS.add(FEATURES); | ||
ALL_OPTIONS.add(FEATURES_DISABLED); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
config-api/src/main/java/org/keycloak/config/HealthOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.keycloak.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class HealthOptions { | ||
|
||
public static final Option HEALTH_ENABLED = new OptionBuilder<>("health-enabled", Boolean.class) | ||
.category(OptionCategory.HEALTH) | ||
.description("If the server should expose health check endpoints. If enabled, health checks are available at the '/health', '/health/ready' and '/health/live' endpoints.") | ||
.defaultValue(Boolean.FALSE) | ||
.buildTime(true) | ||
.expectedValues(Boolean.TRUE, Boolean.FALSE) | ||
.build(); | ||
|
||
public static final List<Option<?>> ALL_OPTIONS = new ArrayList<>(); | ||
|
||
static { | ||
ALL_OPTIONS.add(HEALTH_ENABLED); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
config-api/src/main/java/org/keycloak/config/HostnameOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.keycloak.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class HostnameOptions { | ||
|
||
public static final Option HOSTNAME = new OptionBuilder<>("hostname", String.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("Hostname for the Keycloak server.") | ||
.build(); | ||
|
||
public static final Option HOSTNAME_ADMIN = new OptionBuilder<>("hostname-admin", String.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("The hostname for accessing the administration console. Use this option if you are exposing the administration console using a hostname other than the value set to the 'hostname' option.") | ||
.build(); | ||
|
||
public static final Option HOSTNAME_STRICT = new OptionBuilder<>("hostname-strict", Boolean.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("Disables dynamically resolving the hostname from request headers. Should always be set to true in production, unless proxy verifies the Host header.") | ||
.defaultValue(Boolean.TRUE) | ||
.build(); | ||
|
||
public static final Option HOSTNAME_STRICT_HTTPS = new OptionBuilder<>("hostname-strict-https", Boolean.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("Forces URLs to use HTTPS. Only needed if proxy does not properly set the X-Forwarded-Proto header.") | ||
.runtimes(Option.Runtime.OPERATOR) | ||
.defaultValue(Boolean.TRUE) | ||
.build(); | ||
|
||
public static final Option HOSTNAME_STRICT_BACKCHANNEL = new OptionBuilder<>("hostname-strict-backchannel", Boolean.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("By default backchannel URLs are dynamically resolved from request headers to allow internal and external applications. If all applications use the public URL this option should be enabled.") | ||
.build(); | ||
|
||
public static final Option HOSTNAME_PATH = new OptionBuilder<>("hostname-path", String.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("This should be set if proxy uses a different context-path for Keycloak.") | ||
.build(); | ||
|
||
public static final Option HOSTNAME_PORT = new OptionBuilder<>("hostname-port", Integer.class) | ||
.category(OptionCategory.HOSTNAME) | ||
.description("The port used by the proxy when exposing the hostname. Set this option if the proxy uses a port other than the default HTTP and HTTPS ports.") | ||
.defaultValue(-1) | ||
.build(); | ||
|
||
public static final List<Option<?>> ALL_OPTIONS = new ArrayList<>(); | ||
|
||
static { | ||
ALL_OPTIONS.add(HOSTNAME); | ||
ALL_OPTIONS.add(HOSTNAME_STRICT); | ||
ALL_OPTIONS.add(HOSTNAME_STRICT_HTTPS); | ||
ALL_OPTIONS.add(HOSTNAME_STRICT_BACKCHANNEL); | ||
ALL_OPTIONS.add(HOSTNAME_PATH); | ||
ALL_OPTIONS.add(HOSTNAME_PORT); | ||
} | ||
} |
Oops, something went wrong.