Custom collection.cfg settings

Managed by | Updated .

Arbitrary settings can be stored inside the collection configuration file collection.cfg. Settings that Funnelback doesn't recognize will be ignored and left as-is. These arbitrary settings can then be accessed from various parts of the system such as templates and filters.

This is especially useful to store configuration values rather than hard-coding them in the templates or filters: URLs of 3rd party resources, API keys to access a service, etc.

api.key=12345678
logo.url=http://example.org/logo.png 

Accessing custom configuration settings

Search template (FreeMarker)

<img src="${question.collection.configuration.value("logo.url")}" />

Public UI hook script (Groovy)

def key = transaction.question.collection.configuration.value("api.key")

Filter (Groovy)

def key = this.config.value("api.key")

Workflow script (Groovy)

MyScript.Groovy
// Add the relevant import at the top
import com.funnelback.common.config.*

// Then:
def config = new NoOptionsConfig(new File("/path/to/search-home"), "collection-name")
key = config.value("api.key")

Additional Resources

Was this artcle helpful?

Comments