Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This code is placed in the public domain by its author, Tim Peierls.
- */
- package com.example.server;
- import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
- /**
- * A module that binds AWS credentials whether passed as "com.example.server.xxx"
- * system properties or Elastic Beanstalk system properties. Client code inject
- * these values using @Named, e.g.,
- * <pre>
- * @Inject AwsDependent(@Named(AWS_ACCESS_KEY_ID) String accessKeyId,
- * @Named(AWS_SECRET_KEY) String secretKey) { ... }
- * </pre>
- */
- public class AwsCredentialsModule extends ConfigurationModule {
- public static final String AWS_ACCESS_KEY_ID = "aws.access.key.id";
- public static final String AWS_SECRET_KEY = "aws.secret.key";
- @Override protected void bindConfigurations() {
- bindProperty(AWS_ACCESS_KEY_ID)
- .toValue("${com.example.server.accesskeyid|}${AWS_ACCESS_KEY_ID|}");
- bindProperty(AWS_SECRET_KEY)
- .toValue("${com.example.server.secretaccesskey|}${AWS_SECRET_KEY|}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement