Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-92477 rename env variable #139

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class DefectUpdateStatisticsJob extends BaseJob {
private final RestTemplate restTemplate;

private final String measurementId;
private final String apiSecret;
private final String gaId;


/**
Expand All @@ -73,11 +73,11 @@ public class DefectUpdateStatisticsJob extends BaseJob {
@Autowired
public DefectUpdateStatisticsJob(JdbcTemplate jdbcTemplate,
@Value("${rp.environment.variable.ga.measurementId}") String measurementId,
@Value("${rp.environment.variable.ga.apiSecret}") String apiSecret,
@Value("${rp.environment.variable.ga.id}") String gaId,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
super(jdbcTemplate);
this.measurementId = measurementId;
this.apiSecret = apiSecret;
this.gaId = gaId;
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
this.restTemplate = new RestTemplate();
}
Expand All @@ -92,9 +92,9 @@ public DefectUpdateStatisticsJob(JdbcTemplate jdbcTemplate,
@Transactional
public void execute() {
LOGGER.info("Start sending items defect update statistics");
if (StringUtils.isEmpty(measurementId) || StringUtils.isEmpty(apiSecret)) {
if (StringUtils.isEmpty(measurementId) || StringUtils.isEmpty(gaId)) {
LOGGER.info(
"Both 'measurementId' and 'apiSecret' environment variables should be provided in order to run the job 'defectUpdateStatisticsJob'");
"Both 'measurementId' and 'gaId' environment variables should be provided in order to run the job 'defectUpdateStatisticsJob'");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [reviewdog] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 100 characters (found 138).

return;
}

Expand Down Expand Up @@ -179,7 +179,7 @@ private void sendRequest(JSONObject requestBody) {
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> request = new HttpEntity<>(requestBody.toString(), headers);

String url = String.format(GA_URL, measurementId, apiSecret);
String url = String.format(GA_URL, measurementId, gaId);

var response = restTemplate.exchange(url, POST, request, String.class);
if (response.getStatusCodeValue() != 204) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rp:
## 1 minute
cron: '0 */1 * * * *'
ga:
apiSecret:
id:
measurementId:
cron: '0 0 */24 * * *'
executor:
Expand Down
Loading