-
Notifications
You must be signed in to change notification settings - Fork 168
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
Support Variable Depths and improve regex #118
Support Variable Depths and improve regex #118
Conversation
234fac1
to
5b5bbe3
Compare
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.
Thanks for your contribution! Maybe the tests could go into store/ssmstore_test.go
? It's true we don't run any tests in the Makefile; they can be run with go test ./...
Oh I did not notice the test there, my bad ill add them |
@nickatsegment I noticed that EDIT: |
No worries. :)
I was thinking just simple unit tests for
Probably :) Wanna cut a bug for that? |
5b5bbe3
to
d001a2c
Compare
@nickatsegment Added the tests, which found some small issues (which I believe would not happen anyway because of how the rest of the components work) and fixed it. Added tests for |
Cool. Out of scope, but at some point it'd be nice to centralize this validation. Tests pass on my machine, so LGTM. I'm going to loop in some of the other maintainers before merging: I'm new :) |
I agree. I mentioned on the linked #119 that we should do that as well, not only for the test but I believe it is probably for the best that both validations are the same. |
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.
- add dash support into regexps
- update tests with dash case
cmd/root.go
Outdated
validServiceFormat = regexp.MustCompile(`^[A-Za-z0-9-_]+$`) | ||
validKeyFormat = regexp.MustCompile(`^[\w\.]+$`) | ||
validServiceFormat = regexp.MustCompile(`^[\w]+(\.[\w]+)*$`) | ||
validServicePathFormat = regexp.MustCompile(`^[\w]+(\/[\w\.]+)*$`) |
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.
does not support dashes
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.
^[\w\.-]+$
^[\w-]+(\.[\w-]+)*$
^[\w-]+(\/[\w\.-]+)*$
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.
@AndreyMarchuk Good catches, I updated the test cases and the regex both for SSM and for the CMD. I will put it as a fixup, so you can see the changes, once we are ready to merge I can squash them.
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.
One slight comment, I left some of the old functionality where a /./this
path/key is allowed, which I believe should be fine and it leaves on the user's hands using a proper naming convention.
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.
Awesome, thanks! I like that we are doing a quick progress.
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.
This should be ready to review now.
Hi everyone, I'm late in the game here, big thumbs up for everyone contributing! I see quite some effort was made already into giving the service a different path which is just what I was looking for 👍 My idea (#128) however is different from implementation and would like to see comments on it.. I suggested having a This would keep the Dockerfile cleaner and I think a bit more context agnostic. If the same docker is deployed in the same region using a different path (think of migrations) with the current PR, it would look like:
Having chamber interpolating SSM_PATH_NAMESPACE as ENV var, it would look like this:
The other advantage of having a single depth service with a prepend is that this leaves the possibility for a later moment to create variables with variable depth .. One could do a replace on / with _ and you can then have /service/monitoring/logging_this_app_key MONITORING_LOGGING_THIS_APP_KEY /service/monitoring/data_api_key MONITORING_DATA_API_KEY Thanks! |
@maartenvanderhoef I think your requirement it covered by this PR, we could also add the ENV VAR, but Isn't it easier to just interpolate your prefix on your CMD line? |
31f5973
to
3413da6
Compare
Not that |
Hi Gonzalo, that's right, it's covered 👍. I think it would be great if an ENV VAR could work as well.. I think that it is more clean looking compared to Dockerfiles which have to 'interpolate' a variable in the entrypoint or cmd. |
I would keep that as a separate PR as it is a different feature, and it can be done sort of easily once this is merged. |
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.
Looks good to me! Also tested it locally as a sanity check. Thanks for adding this feature.
Excellent, I'll squash for merge
…On Mon, Sep 10, 2018, 6:01 PM Rob McQueen ***@***.***> wrote:
***@***.**** approved this pull request.
Looks good to me! Also tested it locally as a sanity check. Thanks for
adding this feature.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#118 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJcviSztF1L2IHD5ZSXaVZTwwJ2QxdbCks5uZozBgaJpZM4WRNOG>
.
|
ae4c1f4
to
75ff80b
Compare
@systemizer @AndreyMarchuk @nickatsegment given the approves so far, I squashed the fixups, so this is ready to merge. |
@pecigonzalo Thanks! Merged. FYI we almost always do a squash and merge |
Based on the work of #70 but improving the regex and adding a separate validator for
/
paths.Given we have no tests, I have left some comments explaining how the validation is expected to work, but I can easily remove it if you believe its too much noise/ugly. (which it is, but I dont know how else to document this in this repo)
Relates to: #70