-
Notifications
You must be signed in to change notification settings - Fork 68
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
Converting Rails config to railsconfig #823
Conversation
@@ -0,0 +1,8 @@ | |||
hca: | |||
endpoint: https://test-foo.vets.gov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with a fake url since the VA is touchy about real endpoints being in a public repo. This can be overridden for dev by putting something like this into config/settings.local.yml
:
hca:
endpoint: https://some-real-endpoint.va.gov
There was also some weird name conflict with the EVSS stuff, hence https://test-foo.vets.gov
instead of just https://test.vets.gov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The override options may provide some flexibility with deployment configuration, which could prove useful. So 👍 there.
I prefer when platform optimization settings are defined with a RAILS_ENV, and application configuration is not dependent on the RAILS_ENV more in line with https://12factor.net/config. If we need to start using varying RAILS_ENVs then we'll need some changes to the devops deployments, which all run in production
, along with some thought to how this affects the review instances.
Depending on how other folks on the application development teams feel, it'd likely be worth applying globally vs maintaining multiple configuration gems (figaro + railsconfig).
We can use this as we use Figaro now, with the And yeah, whatever we choose for this I'd like to apply globally for all app configuration. |
@knkski can you pls provide an update here? |
@leannammiller: Sure. This is mostly done, just needs some testing. I'm working on getting the devops side of things ready to go: https://github.com/department-of-veterans-affairs/devops/pull/1520. I expect to have that ready to push to dev by tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach a lot better than using environment variables, although I'm concerned about the size of the change here. Could we have changed one piece of the app at a time so we didn't have to make such a big single PR? Also, can we add some content to the PR instructing people about how to setup the configuration locally?
spec/support/aws_helpers.rb
Outdated
REPORTS_AWS_S3_BUCKET: 'bucket' | ||
) do | ||
# TODO(knkski): Find better way than `1.times do ...` | ||
1.times do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently I don't. I was running into an issue with a failing unit test, but I think it was actually unrelated to this.
expect(subject.aws_acl).to eq('private') | ||
expect(subject.aws_bucket).to eq('evss_s3_bucket') | ||
end | ||
Settings.evss.s3.uploads_enabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about these things where if the test raises an exception then it could cause the value to not be set back to false. Presumably that's what the ClimateControl thing handles by doing it in a block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I was wondering if there was a nice way to do that in Ruby other than just something like this:
begin
Settings.foo = true
expect(something).to eq(true)
ensure
Settings.foo = false
end
If not, I'll go and convert these tests to ^^ format if that looks fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a little ugly.... If you can make a function that takes the things you want to change as an argument then that function can itself contain the begin/ensure block:
def change_stuff(what_to_change)
begin
apply_changes
yield
ensure
roll_back_changes
end
end
In your case, I think it would be possible to do this by passing a hash to such a function:
change_stuff(foo: true)
Then the function could loop over the hash and make the requested changes to the Settings. This does seem like it could use some more thought though.... there might be cases where that doesn't work very well.
@aub: Definitely could have went with smaller chunked PRs. The worry I had with that is that we'd get halfway done, get distracted by something urgent and end up with n+1 ways of configuring Adding documentation sounds great, I'll get that added. |
README.md
Outdated
- Copy the [certificate](https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Identity%20Discovery%202016/certificates/vetsgov-localhost.crt) to ~/.certs | ||
- Copy the [key](https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Identity%20Discovery%202016/certificates/vetsgov-localhost.key) to ~/.certs | ||
- Create a hidden folder in your home directory: `mkdir ~/.certs` | ||
- TODO(knkski): These are in a private repo... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aub: These certs are now residing in a private repo. Do we want to make those available somehow, or just add a note telling external contributors to do something like touch ~/.certs/vetsgov-localhost.crt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I think it's important that these be private, but I'm not sure what to tell people to do.
@aub: Added |
Fixes https://github.com/department-of-veterans-affairs/vets.gov-team/issues/1299
The major advantages of railsconfig over the other options are that it supports YAML syntax unlike dotenv, and it supports local overrides unlike Figaro. It is also is easier to configure than Figaro, since the YAML can be grouped into blocks and doesn't have to look like
ES_CLIENT_KEY_PATH: foo
.