java.lang.Object
com.erudika.para.core.utils.Config
- Direct Known Subclasses:
ParaConfig
This class loads configuration settings from a file and sets defaults.
- Author:
- Alex Bogdanovski [[email protected]]
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
"appid".static final String
"creatorid".static final String
"email".static final String
"etoken".static final String
"groups".static final String
"id".static final String
"identifier".static final String
"key".static final String
"name".static final String
"parentid".static final String
"password".static final String
"properties".static final String
"token".static final String
"tags".static final String
"timestamp".static final String
"type".static final String
"updated".static final String
"version".static final String
Amazon prefix - defaults to 'az:'.static final int
10000.static final String
Facebook prefix - defaults to 'fb:'.static final String
GitHub prefix - defaults to 'gh:'.static final String
Google prefix - defaults to 'gp:'.static final String
LDAP prefix - defaults to 'ldap:'.static final String
LinkedIn prefix - defaults to 'in:'.static final String
Mattermost prefix - defaults to 'mm:'.static final String
Microsoft prefix - defaults to 'ms:'.static final String
OAuth2 generic prefix - defaults to 'oa2:'.static final String
OAuth2 second generic prefix - defaults to 'oa2second:'.static final String
OAuth2 third generic prefix - defaults to 'oa2third:'.static final String
"para".static final String
Passwordless auth prefix - defaults to 'custom:'.static final String
SAML prefix - defaults to 'saml:'.static final String
Slack prefix - defaults to 'sl:'.static final String
Twitter prefix - defaults to 'tw:'. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.typesafe.config.Config
Returns the Config object.The name of the configuration file, usually 'app-application.conf'.abstract String
The root prefix of the configuration property names, e.g.getConfigValue
(String key, String defaultValue) Returns the unwrapped value of a configuration parameter or its default value.Constructs a sorted set of configuration keys.static com.typesafe.config.Config
parseFileWithoutIncludes
(File file) Parses a HOCON file with includes disabled.static com.typesafe.config.Config
parseStringWithoutIncludes
(String config) Parses a HOCON string with includes disabled.render
(boolean asJson) Renders the current configuration as a String, taking into account system properties and ENV precedence ordering.renderConfigDocumentation
(String format, boolean groupByCategory) Renders all configuration options along with their documentation and default values.void
store()
Stores all available configuration to a file, overwriting the existing one.
-
Field Details
-
PARA
-
_TYPE
-
_APPID
-
_CREATORID
-
_ID
-
_IDENTIFIER
-
_KEY
-
_NAME
-
_PARENTID
-
_PASSWORD
-
_RESET_TOKEN
-
_EMAIL_TOKEN
-
_TIMESTAMP
-
_UPDATED
-
_TAGS
-
_EMAIL
-
_GROUPS
-
_VERSION
-
_PROPERTIES
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMIT10000.- See Also:
-
FB_PREFIX
-
GPLUS_PREFIX
-
LINKEDIN_PREFIX
-
TWITTER_PREFIX
-
GITHUB_PREFIX
-
MICROSOFT_PREFIX
-
SLACK_PREFIX
-
MATTERMOST_PREFIX
-
AMAZON_PREFIX
-
OAUTH2_PREFIX
-
OAUTH2_SECOND_PREFIX
OAuth2 second generic prefix - defaults to 'oa2second:'.- See Also:
-
OAUTH2_THIRD_PREFIX
OAuth2 third generic prefix - defaults to 'oa2third:'.- See Also:
-
LDAP_PREFIX
-
SAML_PREFIX
-
PASSWORDLESS_PREFIX
Passwordless auth prefix - defaults to 'custom:'.- See Also:
-
-
Constructor Details
-
Config
public Config()
-
-
Method Details
-
getConfigFilePath
The name of the configuration file, usually 'app-application.conf'.- Returns:
- prefix-application.conf or the value of @{code config.file} system property.
-
getConfigRootPrefix
The root prefix of the configuration property names, e.g. "para".- Returns:
- the root prefix for all config property keys.
-
getConfigValue
-
getConfig
public com.typesafe.config.Config getConfig()Returns the Config object.- Returns:
- the config object
-
getSortedConfigKeys
Constructs a sorted set of configuration keys. Heavily relies on theDocumented
annotation for sort order.- Returns:
- a set of map of config keys, without the root prefix (path), to config categories.
-
store
public void store()Stores all available configuration to a file, overwriting the existing one. In case of HOCON, the commented lines are collected from existing file and appended at the end. -
render
- Parameters:
asJson
- if true, a JSON object will be rendered, otherwise the HOCON format is used- Returns:
- config as string
- See Also:
-
render
Renders the current configuration as a String, taking into account system properties and ENV precedence ordering.- Parameters:
asJson
- if true, a JSON object will be rendered, otherwise the HOCON format is usedhoconHeader
- file headerhoconFooter
- file footer- Returns:
- config as string
-
renderConfigDocumentation
Renders all configuration options along with their documentation and default values.- Parameters:
format
- one of "hocon", "json" or "markdown"groupByCategory
- if true, will group properties by category- Returns:
- a HOCON, JSON or MD string
-
getConfigMap
-
parseFileWithoutIncludes
Parses a HOCON file with includes disabled.- Parameters:
file
- a file- Returns:
- a Config object
-
parseStringWithoutIncludes
Parses a HOCON string with includes disabled.- Parameters:
config
- HOCON confing string- Returns:
- a Config object
-