Class Configuration
java.lang.Object
org.noise_planet.noisemodelling.webserver.Configuration
Manage webserver configuration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Writer implementation that redirects output to an SLF4J Logger instance. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.commons.cli.OptionsBuild the CLI Options definition used for both CLI and JSON parsing.static ConfigurationCreates a Configuration object from command-line arguments (backward compatible entry point).static ConfigurationcreateConfigurationFromCommandLine(String[] args, org.apache.commons.cli.Options options) Creates a Configuration object from command-line arguments using the provided Options definition.Returns the application root URL.Returns the custom configuration map.intgetPort()Returns the script path.Returns the secure base admin password.Returns the secure base admin user.Returns the encryption secret for the secure base.Returns the working directory path.booleanReturns whether the server is in unsecure mode.voidsetApplicationRootUrl(String applicationRootUrl) Sets the application root URL.voidsetCustomConfiguration(Map<String, Object> customConfiguration) Sets the custom configuration map.voidsetPort(int port) voidsetScriptPath(String scriptPath) Sets the script path.voidsetSecureBaseAdminPassword(String secureBaseAdminPassword) Sets the secure base admin password.voidsetSecureBaseAdminUser(String secureBaseAdminUser) Sets the secure base admin user.voidsetSecureBaseEncryptionSecret(String secureBaseEncryptionSecret) Sets the encryption secret for the secure base.voidsetWorkingDirectory(String workingDirectory) Sets the working directory path.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_APPLICATION_URL
- See Also:
-
DEFAULT_APPLICATION_PROXY_URL
- See Also:
-
NOISE_MODELLING_WEB_SERVER
- See Also:
-
-
Constructor Details
-
Configuration
public Configuration(boolean unsecure)
-
-
Method Details
-
createConfigurationFromArguments
public static Configuration createConfigurationFromArguments(String[] args) throws IllegalArgumentException Creates a Configuration object from command-line arguments (backward compatible entry point). Delegates tocreateConfigurationFromCommandLine(String[], Options)using default options.- Parameters:
args- command-line arguments- Returns:
- Configuration with properties set according to command-line arguments
- Throws:
IllegalArgumentException- if required options are missing or invalid
-
buildOptions
public static org.apache.commons.cli.Options buildOptions()Build the CLI Options definition used for both CLI and JSON parsing. Required flags defined here are also enforced when parsing from JSON. -
createConfigurationFromCommandLine
public static Configuration createConfigurationFromCommandLine(String[] args, org.apache.commons.cli.Options options) throws IllegalArgumentException Creates a Configuration object from command-line arguments using the provided Options definition.- Parameters:
args- command-line argumentsoptions- Apache Commons CLI options definition- Returns:
- Configuration configured from CLI
- Throws:
IllegalArgumentException- if parsing fails
-
getApplicationRootUrl
Returns the application root URL.- Returns:
- the application root URL
-
setApplicationRootUrl
Sets the application root URL.- Parameters:
applicationRootUrl- the application root URL to set
-
getScriptPath
Returns the script path.- Returns:
- the script path
-
setScriptPath
Sets the script path.- Parameters:
scriptPath- the script path to set
-
isUnsecure
public boolean isUnsecure()Returns whether the server is in unsecure mode.- Returns:
- true if unsecure mode is enabled, false otherwise
-
getWorkingDirectory
Returns the working directory path.- Returns:
- the working directory
-
setWorkingDirectory
Sets the working directory path.- Parameters:
workingDirectory- the working directory to set
-
getSecureBaseEncryptionSecret
Returns the encryption secret for the secure base.- Returns:
- the secure base encryption secret
-
setSecureBaseEncryptionSecret
Sets the encryption secret for the secure base.- Parameters:
secureBaseEncryptionSecret- the encryption secret to set
-
getSecureBaseAdminUser
Returns the secure base admin user.- Returns:
- the secure base admin user
-
setSecureBaseAdminUser
Sets the secure base admin user.- Parameters:
secureBaseAdminUser- the admin user to set
-
getSecureBaseAdminPassword
Returns the secure base admin password.- Returns:
- the secure base admin password
-
setSecureBaseAdminPassword
Sets the secure base admin password.- Parameters:
secureBaseAdminPassword- the admin password to set
-
getCustomConfiguration
Returns the custom configuration map.- Returns:
- the custom configuration
-
setCustomConfiguration
Sets the custom configuration map.- Parameters:
customConfiguration- the custom configuration to set
-
getPort
public int getPort()- Returns:
- Server port
-
getWebSiteFullUrl
- Returns:
- Return the full website url to type in the browser window
-
setPort
public void setPort(int port) - Parameters:
port- Server port
-