Configure sentry-java by typesafe-config.
Using Maven:
<dependency>
<groupId>com.github.nomadblacky</groupId>
<artifactId>sentry-config</artifactId>
<version>0.4.0</version>
</dependency>
Using Gradle:
compile 'com.github.nomadblacky:sentry-config:0.4.0'
Using SBT:
libraryDependencies += "com.github.nomadblacky" % "sentry-config" % "0.4.0"
sentry {
dsn = "https://public:private@host:port/1"
environment = "production"
}
Using JVM options:
$ java -Dsentry.factory=com.github.nomadblacky.sentry.config.SentryClientFactory
or
Using sentry.properties
:
factory=com.github.nomadblacky.sentry.config.SentryClientFactory
Supported configurations
See the examples in src/test/resources/application.conf
.
package sample;
import com.github.nomadblacky.sentry.config.DefaultTypesafeConfigSentryClientFactory;
public class MyCustomSentryClientFactory extends DefaultTypesafeConfigSentryClientFactory {
@Override
public SentryClient createSentryClient(Dsn dsn) {
// Initialize a SentryClient with typesafe-config.
SentryClient client = super.createSentryClient(dsn);
client.addBuilderHelper(new CustomEventBuilderHelper());
return client;
}
}
public class CustomEventBuilderHelper implements EventBuilderHelper {
@Override
public void helpBuildingEvent(EventBuilder eventBuilder) {
// Helping to build events!
}
}
$ java -Dsentry.factory=sample.MyCustomSentryClientFactory
or
factory=sample.MyCustomSentryClientFactory