Skip to content
New issue

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

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

Already on GitHub? # to your account

Read credentials from Rails config file #705

Closed
martin-mfv opened this issue Mar 16, 2024 · 1 comment
Closed

Read credentials from Rails config file #705

martin-mfv opened this issue Mar 16, 2024 · 1 comment

Comments

@martin-mfv
Copy link

Currently, I want to create a Fog connection with params read from file config/aws.yml
For example:

default: &default
  aws_access_key: 
  aws_secret_key: 
  aws_region:  
  aws_endpoint: 

development:
  <<: *default

production:
  <<: *default

Can that be supported?

@geemus
Copy link
Member

geemus commented Mar 19, 2024

Within the rails context I think you should be able to load data from a file such as this with something like config_for(:aws), based on referencing these rails docs: https://guides.rubyonrails.org/configuring.html#custom-configuration.

So the most direct way would be to match up the keys in this file to the ones fog expects, so that you could just pass the return value from the config_for into the fog initializer. Hopefully that can get you what you need, and I don't think it should require any changes to fog-aws to support it.

I would be wary of using a default and/or using the same credentials in development and production though, as this could make it easy to accidentally override production data.

Hope that helps, since I don't think this should require changes I'll close this for now.

@geemus geemus closed this as completed Mar 19, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants