-
Notifications
You must be signed in to change notification settings - Fork 203
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
Configuration switching #1584
Comments
#527 Related issue |
https://github.com/aws-amplify/amplify-android/discussions/215 Related issue on Android |
There are multiple scenarios to cover. These are listed below.
Scenario 1By default when Amplify is configured it will load enum Failure: Error {
case configurationFileNotFound
}
init() {
do {
try configureAmplify(region: "EU")
} catch {
fatalError("Failed to configure Amplify: \(error)")
}
}
func configureAmplify(region: String) throws {
guard let configPath = Bundle.main.path(forResource: "amplifyconfiguration-\(region)",
ofType: "json") else {
throw Failure.configurationFileNotFound
}
let configURL = URL(fileURLWithPath: configPath)
let configuration = try AmplifyConfiguration(configurationFile: configURL)
// TODO: add plugins
try Amplify.configure(configuration)
} Scenario 2The Amplify CLI supports multiple environments such has dev, qa and prod. You can switch between these environments which will change the contents of Scenario 3Dynamically changing the configuration after the app has already been configured is not supported. This is due to operations which are still in process. There is no support tracking all operations which could cancel each of them and wait until they are completed before switching over to the other configuration. This issue covers this scenario as a feature request. |
Anyone has any updates, please? |
@sonic555gr The team is still trying to prioritize the feature internally. We will post an update on the issue as soon as we have more information. |
Thank you. This feature is needed for our business model. As we have 1 app with multiple potential pools with different accounts for every physical user. At the moment, after the user logs out from one pool and tries to login into a different pool, we force shut the app and ask them to relaunch which feels wrong as UX goes. This feature will go a long way to improve our app. |
At this moment, Amplify does not offer any features/workarounds that can support this use case. Please keep watching this issue for updates. |
Hello, please has there been any update regarding this feature? |
Running into the issue of not being able to re-configure during runtime. |
This is not a supported use case. It would need to be implemented as part this feature request. The weird behaviour you see is because of Amplify maintaining configuration states at several places in the code. We are definitely open to seeing a community PR and will prioritize reviewing any PR's opened by our community members. |
Hi @DrBeak1 did you had any progress with fork? My company needs the same functionality, as we support multi-tenant approach with different regions. While on the web, it is natively switched, but we have only one mobile app that should support all the regions. The weird thing, we have Demo environment we separate aws stack from production and need to switch between them smoothly. I am also thinking about the forking the lib with the goal to achieve this |
@yanz-safe My team decided it was less risky to just handle the lock state gracefully. In our case, if a user tries to log in with one region the app is essentially locked to that region until they kill the app. The edge case is only an issue if a user tries to (a) sign in and fails because they tried to log in with the wrong region selected, or (b) if the user logs out of one user/region and then needs to login with a user that has a different region. |
@DrBeak1 thanks for answer. |
@harsh62 - any update on this? This is blocking us, in our mobile app, user can switch different countries and based on country they will go to different aws region... Outside this, we also have a test app that connects to different environments that target different aws account and regions. At minimum, can Amplify.reset() method which currently is internal be made public so caller can reset and reconfigure? |
Is your feature request related to a problem? Please describe.
An app which is used in multiple regions will need to switch configurations to use a different configuration. When a user logs out and then logs into a different region it is necessary to change the configuration. There is no support currently do this without restarting the app.
Describe the solution you'd like
Support an API to define multiple configurations and switch between regions.
Describe alternatives you've considered
None
Is the feature request related to any of the existing Amplify categories?
Auth
Additional context
No response
The text was updated successfully, but these errors were encountered: