Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up different awsconfiguration.json file for different environment. #11

Open
yuensunn opened this issue Nov 4, 2019 · 1 comment

Comments

@yuensunn
Copy link

yuensunn commented Nov 4, 2019

My current app has 2 different user pools for production and development. Is there any way to configure awsconfiguration.json seperately? Thank you!

@doc-rj-celltrak
Copy link

See the README here: https://github.com/awslabs/aws-mobile-appsync-sdk-android

You can override the Default configuration by using the AWSConfiguration#setConfiguration() method.

{
    "AppSync": {
        "Default": {
            "ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
            "Region": "us-east-1",
            "ApiKey": "YOUR-API-KEY",
            "AuthMode": "API_KEY"
        },
        "Custom": {
            "ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
            "Region": "us-east-2",
            "ApiKey": "YOUR-API-KEY",
            "AuthMode": "API_KEY"
        }
   }
}

AWSConfiguration awsConfig = new AWSConfiguration(context);
awsConfig.setConfiguration("Custom");

AWSAppSyncClient client = AWSAppSyncClient.builder()
                    .context(context)
                    .awsConfiguration(awsConfig)
                    .build();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants