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() {} }