Skip to content

Commit

Permalink
feat (tutorial/auto-subscribe) SMS region is 'us' by default. Remove …
Browse files Browse the repository at this point in the history
…hard coded init and manage different region from configuration file
  • Loading branch information
JPPortier committed Nov 4, 2024
1 parent f4b5c8c commit 7094ca2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ public class Config {
@Value("${credentials.key-secret}")
String keySecret;

@Value("${sms.region}")
String smsRegion;

@Bean
public SMSService smsService() {

var configuration =
Configuration.builder()
.setProjectId(projectId)
.setKeyId(keyId)
.setKeySecret(keySecret)
.setSmsRegion(SMSRegion.US)
.build();
var builder =
Configuration.builder().setProjectId(projectId).setKeyId(keyId).setKeySecret(keySecret);

return new SinchClient(configuration).sms();
if (!smsRegion.isEmpty()) {
builder.setSmsRegion(SMSRegion.from(smsRegion));
}
return new SinchClient(builder.build()).sms();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ server:
credentials:
project-id:
key-id:
key-secret:
key-secret:

# Set a value if not using the default "us" region
sms:
region:

0 comments on commit 7094ca2

Please sign in to comment.