Package io.mangoo.core
Class Config
java.lang.Object
io.mangoo.core.Config
Main configuration class for all properties configured in 'config.props'
- Author:
- svenkubiak, williamdunne
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglongintbooleangetBoolean(Key key) Retrieves a configuration value with the given key constant (e.g.booleangetBoolean(Key key, boolean defaultValue) Retrieves a configuration value with the given key constant (e.g.booleangetBoolean(String key) Retrieves a configuration value with the given keybooleangetBoolean(String key, boolean defaultValue) Retrieves a configuration value with the given keyintintcom.google.re2j.Patterncom.google.re2j.PatternintRetrieves a configuration value with the given key constant (e.g.intRetrieves a configuration value with the given key constant (e.g.intRetrieves a configuration value with the given keyintRetrieves a configuration value with the given keylongRetrieves a configuration value with the given key constant (e.g.longRetrieves a configuration value with the given key constant (e.g.longRetrieves a configuration value with the given keylongRetrieves a configuration value with the given keygetMongoAuthDB(String prefix) getMongoDbName(String prefix) getMongoHost(String prefix) getMongoPackage(String prefix) getMongoPassword(String prefix) intgetMongoPort(String prefix) getMongoUsername(String prefix) intlongintRetrieves a configuration value with the given key constant (e.g.Retrieves a configuration value with the given key constant (e.g.Retrieves a configuration value with the given keyRetrieves a configuration value with the given keylongbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisMongoAuth(String prefix) booleanisMongoEmbedded(String prefix) booleanbooleanbooleanbooleanbooleanConverts config values to standard java properties
-
Constructor Details
-
Config
public Config() -
Config
-
-
Method Details
-
toProperties
Converts config values to standard java properties- Returns:
- Properties instance with config values
-
isDecrypted
public boolean isDecrypted()- Returns:
- True if decryption of config values was successful, false otherwise
-
getString
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as String or null if the key is not configured
-
getString
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as String or the passed defautlValue if the key is not configured
-
getInt
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as int or 0 if the key is not configured
-
getLong
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as long or 0 if the key is not configured
-
getLong
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as int or the passed defautlValue if the key is not configured
-
getInt
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as int or the passed defautlValue if the key is not configured
-
getBoolean
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as boolean or false if the key is not configured
-
getBoolean
Retrieves a configuration value with the given key- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as boolean or the passed defautlValue if the key is not configured
-
getString
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as String or null if the key is not configured
-
getString
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as String or the passed defautlValue if the key is not configured
-
getLong
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as long or null if the key is not configured
-
getLong
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as long or the passed defautlValue if the key is not configured
-
getInt
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as int or 0 if the key is not configured
-
getInt
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as int or the passed defautlValue if the key is not configured
-
getBoolean
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)- Returns:
- The configured value as boolean or false if the key is not configured
-
getBoolean
Retrieves a configuration value with the given key constant (e.g. Key.APPLICATION_NAME)- Parameters:
key- The key of the configuration value (e.g. application.name)defaultValue- The default value to return of no key is found- Returns:
- The configured value as boolean or the passed defautlValue if the key is not configured
-
getAllConfigurations
- Returns:
- All configuration options of the current environment
-
getApplicationName
- Returns:
- application.name from config.props
-
getFlashCookieName
- Returns:
- flash.cookie.name or default value if undefined
-
getSessionCookieName
- Returns:
- session.cookie.name from config.props or default value if undefined
-
getApplicationSecret
- Returns:
- application.secret from config.props
-
getApplicationPublicKey
- Returns:
- application.publickey from config.props
-
getAuthenticationCookieName
- Returns:
- authentication.cookie.name from config.props or default value if undefined
-
getSessionCookieTokenExpires
public long getSessionCookieTokenExpires()- Returns:
- session.cookie.token.expires from config.props or default value if undefined
-
isSessionCookieSecure
public boolean isSessionCookieSecure()- Returns:
- session.cookie.secure from config.props or default value if undefined
-
isAuthenticationCookieSecure
public boolean isAuthenticationCookieSecure()- Returns:
- authentication.cookie.secure from config.props or default value if undefined
-
getI18nCookieName
- Returns:
- i18n.cookie.name from config.props or default value if undefined
-
isFlashCookieSecure
public boolean isFlashCookieSecure()- Returns:
- calls isSessionCookieSecure()
-
getApplicationLanguage
- Returns:
- application.language from config.props or default value if undefined
-
getApplicationAdminUsername
- Returns:
- application.admin.username from config.props or null if undefined
-
getApplicationAdminPassword
- Returns:
- application.admin.password from config.props or null if undefined
-
getSchedulerPoolsize
public int getSchedulerPoolsize()- Returns:
- scheduler.poolsize from config.props or default value if undefined
-
getAuthenticationCookieRememberExpires
public long getAuthenticationCookieRememberExpires()- Returns:
- authentication.cookie.remember.expires from config.props or default value if undefined
-
getApplicationController
- Returns:
- application.controller from config.props or default value if undefined
-
getApplicationTemplateEngine
- Returns:
- application.templateengine from config.props or default value if undefined
-
isApplicationAdminEnable
public boolean isApplicationAdminEnable()- Returns:
- application.admin.enable or default value if undefined
-
getSmtpHost
- Returns:
- smtp.host or default value if undefined
-
getSmtpPort
public int getSmtpPort()- Returns:
- smtp.port or default value if undefined
-
getSmtpUsername
- Returns:
- smtp.username or null value if undefined
-
getSmtpPassword
- Returns:
- smtp.username or null value if undefined
-
getSmtpFrom
- Returns:
- smtp.from or default value if undefined
-
getConnectorHttpHost
- Returns:
- jvm property http.host or connector.http.host or null if undefined
-
getConnectorHttpPort
public int getConnectorHttpPort()- Returns:
- jvm property http.port or connector.http.port or 0 if undefined
-
getConnectorAjpHost
- Returns:
- jvm property ajp.host or connector.ajp.host or null if undefined
-
getConnectorAjpPort
public int getConnectorAjpPort()- Returns:
- jvm property ajp.port or connector.ajp.port or 0 if undefined
-
isCacheCluserEnable
public boolean isCacheCluserEnable()- Returns:
- cache.cluster.enable or default value if undefined
-
isMetricsEnable
public boolean isMetricsEnable()- Returns:
- metrics.enable or default value if undefined
-
getAuthenticationLock
public int getAuthenticationLock()- Returns:
- authentication.lock or default value if undefined
-
getCacheClusterUrl
- Returns:
- cache.cluster.url or null if undefined
-
getUndertowMaxEntitySize
public long getUndertowMaxEntitySize()- Returns:
- undertow.maxentitysize or default value if undefined
-
getSessionCookieSecret
- Returns:
- session.cookie.secret or application secret if undefined
-
getAuthenticationCookieSecret
- Returns:
- authentication.cookie.secret or application secret if undefined
-
getFlashCookieSecret
- Returns:
- flash.cookie.secret or application secret if undefined
-
isSchedulerEnabled
public boolean isSchedulerEnabled()- Returns:
- scheduler.enable or default value if undefined
-
getApplicationAdminSecret
- Returns:
- application.admin.secret or null if undefined
-
isSmtpDebug
public boolean isSmtpDebug()- Returns:
- smtp.debug or default value if undefined
-
isCorsEnable
public boolean isCorsEnable()- Returns:
- cors.enable or default value if undefined
-
getCorsUrlPattern
public com.google.re2j.Pattern getCorsUrlPattern()- Returns:
- cors.urlpattern as compiled pattern or default value if undefined
-
getCorsAllowOrigin
public com.google.re2j.Pattern getCorsAllowOrigin()- Returns:
- cors.policyclass as compiled pattern or default value if undefined
-
getCorsHeadersAllowCredentials
- Returns:
- cors.headers.allowcredentials or default value if undefined
-
getCorsHeadersAllowHeaders
- Returns:
- cors.headers.allowheaders or default value if undefined
-
getCorsHeadersAllowMethods
- Returns:
- cors.headers.allowheaders or default value if undefined
-
getCorsHeadersExposeHeaders
- Returns:
- cors.headers.exposeheaders or default value if undefined
-
getCorsHeadersMaxAge
- Returns:
- cors.headers.maxage or default value if undefined
-
getMongoHost
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.host or default value if undefined
-
getMongoPort
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.port or default value if undefined
-
getMongoUsername
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.username or null if undefined
-
getMongoPassword
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.password or null if undefined
-
getMongoAuthDB
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.authdb or null if undefined
-
isMongoAuth
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.auth or default value if undefined
-
getMongoPackage
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.package or default value if undefined
-
getMongoDbName
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.dbname or default value if undefined
-
isMongoEmbedded
- Parameters:
prefix- The prefix to use- Returns:
- persistence.mongo.embedded or default value if undefined
-
isSessionCookieExpires
public boolean isSessionCookieExpires()- Returns:
- session.cookie.expires or default value if undefined
-
isAuthenticationCookieExpires
public boolean isAuthenticationCookieExpires()- Returns:
- authentication.cookie.expires or default value if undefined
-
getAuthenticationCookieTokenExpires
public long getAuthenticationCookieTokenExpires()- Returns:
- authentication.cookie.expires or default value if undefined
-
isSmtpAuthentication
public boolean isSmtpAuthentication()- Returns:
- smtp.authentication or default value if undefined
-
getSmtpProtocol
- Returns:
- smtp.protocol or default value if undefined
-
isApplicationAdminHealthEnable
public boolean isApplicationAdminHealthEnable()- Returns:
- application.admin.health.enable or default value if undefined
-
getApplicationAdminHealthToken
- Returns:
- application.admin.health.token or null if undefined
-