Skip to content

Commit

Permalink
Update Java configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejwalkowiak committed Nov 23, 2020
1 parent 4515f88 commit 121cae4
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/platforms/java/common/configuration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ Sentry.init(options -> {
});
```

Whem multiple configuration ways are used, options are resolved in the following order:

- system properties
- environment variables
- `sentry.properties` file which location is resolved from the system property `sentry.properties.file`
- `sentry.properties` file which location is resolved from the environment `SENTRY_PROPERTIES_FILE`
- `sentry.properties` located in the root of the classpath
- options provided in Java code

## Configuration methods {#configuration-methods}

There are multiple ways to configure the Java SDK, but all of them take the same options. See below for how to use each configuration method and how the option names might differ between them.
Expand Down Expand Up @@ -80,20 +89,6 @@ System Environment Variable option names require that you replace the `.` with `
SENTRY_ENVIRONMENT=production java -jar app.jar
```

### Configuration via code

The DSN itself can also be configured directly in code:

```java
import io.sentry.Sentry;

Sentry.init(options -> {
options.setDsn("___PUBLIC_DSN___");
});
```

By passing a hardcoded DSN you are no longer able to override the DSN at runtime via Java System Properties or System Environment Variables.

## Options

The following options can all be configured as described above: via a `sentry.properties` file, via Java System Properties, via System Environment variables.
Expand Down

0 comments on commit 121cae4

Please sign in to comment.