dynamoid
dynamoid copied to clipboard
Support multiple configurations
Support two or more aws configuration or specify configuration for model
Could you describe a case when this feature is needed?
Could you describe a case when this feature is needed?
Thank you, for example, in the same rails project, you need to connect two Amazon's DynamoDB, different access_key, secret_key, region
I see. Will add this feature request for the next minor release in 3-4 months.
So actually there are two options:
- to specify config options per model statically
- to specify it dynamically
Let's consider both options. I am still not sure whether we need only one of them or both.
Option #1
Let's consider an example:
class User
include Dynamoid::Document
configure do |config|
config.access_key = 'REPLACE_WITH_ACCESS_KEY_ID'
config.secret_key = 'REPLACE_WITH_SECRET_ACCESS_KEY'
config.region = 'us-west-2'
end
end
Option #2
Consider another example:
class User
include Dynamoid::Document
end
Dynamoid.configure(access_key: '', secret_key: '', region: '') do
User.count
end
I see. Will add this feature request for the next minor release in 3-4 months.
So actually there are two options:
- to specify config options per model statically
- to specify it dynamically
Let's consider both options. I am still not sure whether we need only one of them or both.
Option #1
Let's consider an example:
class User include Dynamoid::Document configure do |config| config.access_key = 'REPLACE_WITH_ACCESS_KEY_ID' config.secret_key = 'REPLACE_WITH_SECRET_ACCESS_KEY' config.region = 'us-west-2' end end
Option #2
Consider another example:
class User include Dynamoid::Document end Dynamoid.configure(access_key: '', secret_key: '', region: '') do User.count end
thank you very much! Specifying configuration options for the model is more flexible, If no configuration is specified, the default configuration is used. This is my humble opinion
I agree, option 1 seems preferable.
It would be very helpful, in my case I'm trying to use a different namespace for one model and it's not possible.
I'd love to see a per-model configuration as well. This helps when needing to deal with data that's sourced from multiple regions (and the source applications can't be housed in a single region).
Will prioritize this task 👍 .
@andrykonchin any updates on this?
No, there is no update yet.