diff options
Diffstat (limited to 'src/main/java/eu/ortlepp/notificationsender/util')
-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() {} + +} |