Last active
December 6, 2018 04:15
-
-
Save annjawn/a9102cff9ad031e37dcc92b8cf9ff278 to your computer and use it in GitHub Desktop.
Modular import Amplify and configure core and Storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Amplify from '@aws-amplify/core'; | |
import Storage from '@aws-amplify/storage'; | |
export function configureAmplify() { | |
Amplify.configure( | |
{ | |
Auth: { | |
identityPoolId: process.env.REACT_APP_identityPoolId, | |
region: process.env.REACT_APP_region, | |
userPoolId: process.env.REACT_APP_userPoolId, | |
userPoolWebClientId: process.env.REACT_APP_userPoolWebClientId, | |
}, | |
Storage: { | |
bucket: process.env.REACT_APP_Bucket_name, | |
region: process.env.REACT_APP_region, | |
identityPoolId: process.env.REACT_APP_identityPoolId | |
} | |
} | |
); | |
} | |
//Configure Storage with S3 bucket information | |
export function SetS3Config(bucket, level){ | |
Storage.configure({ | |
bucket: bucket, | |
level: level, | |
region: 'us-east-1', | |
identityPoolId: process.env.REACT_APP_identityPoolId | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment