public final class CometConfig extends Object
The configuration holder of the Comet Java SDK.
The default configuration values are specified in the resources/reference.conf file. The values in this
file can be overridden by the application.conf file if found in the class path. Additionally, it is possible
to explicitly override configuration options from particular file
using applyConfigOverride(java.io.File). Furthermore, all configuration options defined via
system properties or environment variables precedes all previous configuration sources.
The configuration search order as following (first-listed are higher priority):
applyConfigOverride(java.io.File)application.conf (all resources on classpath with this name)reference.conf (all resources on classpath with this name)To get specific configuration value you should use any static field with name starting with
COMET_, e.g. COMET_API_KEY.
| Modifier and Type | Field and Description |
|---|---|
static ConfigItem |
COMET_API_KEY
The Comet API key.
|
static ConfigItem |
COMET_BASE_URL
The Comet's servers base URL.
|
static ConfigItem |
COMET_MAX_AUTH_RETRIES
The maximal number of authentication retries against Comet.
|
static ConfigItem |
COMET_PROJECT_NAME
The Comet project name.
|
static ConfigItem |
COMET_TIMEOUT_CLEANING_SECONDS
The timeout to clean up all waiting uploads and close connection to the server (seconds).
|
static ConfigItem |
COMET_WORKSPACE_NAME
The Comet workspace name.
|
| Constructor and Description |
|---|
CometConfig() |
| Modifier and Type | Method and Description |
|---|---|
static void |
applyConfigOverride(@NonNull File configFile)
Uses provided configuration file to override some/all default configuration tree values.
|
static void |
applyConfigOverride(@NonNull URL configFileUrl)
Allows overriding default configuration tree with values parsed from provided
URL pointing
to the configuration file. |
static void |
clearConfigOverride()
Restores default configuration values if it was overridden previously.
|
public static final ConfigItem COMET_API_KEY
public static final ConfigItem COMET_PROJECT_NAME
public static final ConfigItem COMET_WORKSPACE_NAME
public static final ConfigItem COMET_BASE_URL
public static final ConfigItem COMET_MAX_AUTH_RETRIES
public static final ConfigItem COMET_TIMEOUT_CLEANING_SECONDS
public static void applyConfigOverride(@NonNull
@NonNull File configFile)
configFile - the configuration file to take configuration parameters from.public static void applyConfigOverride(@NonNull
@NonNull URL configFileUrl)
URL pointing
to the configuration file.configFileUrl - the URL of the configuration file to get overrides from.public static void clearConfigOverride()
Copyright © 2022. All rights reserved.