Skip to content

ConfiguringYourApp

John Ament edited this page Dec 3, 2016 · 8 revisions

Application Configuration With Apache DeltaSpike

Apache DeltaSpike is a CDI utility library, featuring some configuration support.

CLI arguments are also passed in to Hammock. CLI arguments take the form of -key=value or --key value

You have two ways of configuring via DeltaSpike, out of the box. More are to come.

Classpath Properties

On your classpath, you can add a hammock.properties which contains the configuration entries:

  • webserver.port - the listener port - default 8080
  • file.dir - the location to read static files from - default /tmp
  • metrics.uri - the base URI for the Metrics Admin servlet - default /metrics/*
  • webserver.address - the bind address for your webserver
  • webserver.secured.port - the HTTPs port to listen on. if not set, will not start an HTTPs listener
  • webserver.keystore.path - the location of the keystore
  • webserver.keystore.type - the type of keystore
  • webserver.keystore.password - the password of the keystore
  • webserver.truststore.path - the location of the trust store
  • webserver.truststore.type - the type of trust store
  • webserver.truststore.password - the password of the trust store

Custom Property Sources

You can implement any number of custom config sources for your application. One easy way, if you're pointing to a local file, is to extend from PropertiesConfigSource and point to your configuration file, either on the classpath or on the file system.

You can also register the CLIPropertySource with your own Properties instance. Full Details available at https://deltaspike.apache.org/documentation/core.html#DeltaSpikeConfiguration

Hammock will also read properties from the command line, in the form of --key=value or -key value.

Looking for more? There are more modules available or get to testing

Clone this wiki locally