diff options
author | Thorsten Ortlepp <post@ortlepp.eu> | 2024-04-26 00:30:46 +0200 |
---|---|---|
committer | Thorsten Ortlepp <post@ortlepp.eu> | 2024-04-26 00:30:46 +0200 |
commit | e03b55be17261ed13ddf421bcf4a804a083a7614 (patch) | |
tree | 8512120756c494efe53c64f33e61a20316c17186 /src/main/java/eu/ortlepp/notificationsender/util/Config.java | |
parent | b6bdf180c777566bbe908303774e53c7d4e099c4 (diff) | |
download | notification-sender-e03b55be17261ed13ddf421bcf4a804a083a7614.zip |
added implementation
Diffstat (limited to 'src/main/java/eu/ortlepp/notificationsender/util/Config.java')
-rw-r--r-- | src/main/java/eu/ortlepp/notificationsender/util/Config.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/eu/ortlepp/notificationsender/util/Config.java b/src/main/java/eu/ortlepp/notificationsender/util/Config.java new file mode 100644 index 0000000..139ea24 --- /dev/null +++ b/src/main/java/eu/ortlepp/notificationsender/util/Config.java @@ -0,0 +1,40 @@ +package eu.ortlepp.notificationsender.util; + +import software.amazon.awssdk.regions.Region; + +/** + * Required configuration values read from environment variables. + */ +public final class Config { + + /** + * The region of the SNS topic. The Name of the environment variable is REGION. + * Value example: eu-central-1 + */ + public static final Region REGION; + + /** + * The ARN of the SNS topic. The Name of the environment variable is ARN. + * Value example: arn:aws:sns:eu-central-1:123456789:Topic-Name + */ + public static final String ARN; + + + static { + REGION = Region.of(getEnvVar("REGION")); + ARN = getEnvVar("ARN"); + } + + + private static String getEnvVar(final String key) { + String value = System.getenv(key); + if (value == null) { + throw new RuntimeException("environment variable not set: " + key); + } + return value; + } + + + private Config() {} + +} |