Setting the active profile as environment in Rollbar configuration

This will help us segment errors from different environments more easily in the Rollbar UI
This commit is contained in:
Arpit Mohan 2020-04-02 13:49:53 +05:30
parent 01c4a2cc8b
commit f165f0b772
4 changed files with 8 additions and 4 deletions

View File

@ -1,9 +1,11 @@
package com.appsmith.server.configurations;
import com.rollbar.notifier.Rollbar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import static com.rollbar.notifier.config.ConfigBuilder.withAccessToken;
@ -13,8 +15,13 @@ public class RollbarConfig {
@Value("${com.rollbar.access-token}")
String rollbarAccessToken;
@Autowired
Environment env;
@Bean
Rollbar rollbarConfiguration() {
return Rollbar.init(withAccessToken(rollbarAccessToken).build());
return Rollbar.init(withAccessToken(rollbarAccessToken)
.environment(env.getActiveProfiles()[0])
.build());
}
}

View File

@ -31,7 +31,6 @@ oauth2.allowed-domains=
# These properties are intentionally set to random values so that events are not sent to either of them during local development
segment.writeKey=random-value
com.rollbar.access-token=random-value
com.rollbar.environment=development
# Redis Properties
spring.redis.host=redis

View File

@ -31,7 +31,6 @@ spring.security.oauth2.client.provider.github.userNameAttribute=login
# These properties are intentionally set to random values so that events are not sent to either of them during local development
segment.writeKey=random-value
com.rollbar.access-token=random-value
com.rollbar.environment=development
# Redis Properties
spring.redis.host=127.0.0.1

View File

@ -28,7 +28,6 @@ oauth2.allowed-domains=
# Segment & Rollbar Properties
segment.writeKey=B3UBOacfOky4l6dfk5xyR6Dh8vUZYizW
com.rollbar.access-token=b91c4d5b9cac444088f4db9216ed6f42
com.rollbar.environment=development
# Redis Properties
spring.redis.host=ec2-34-254-16-19.eu-west-1.compute.amazonaws.com