-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 -f url
to specify config url
#3098
Conversation
@@ -213,6 +214,9 @@ def find(base_dir, filenames): | |||
os.getcwd(), | |||
[ConfigFile(None, yaml.safe_load(sys.stdin))]) | |||
|
|||
if filename.startswith('./http'): |
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.
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.
How about protocol testing for urllib supported?
I think we could support usual protocols only.
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 think ./http
is kind of hack. But @sergeyklay were you talking about supporting all the protocols? Or you're saying you prefer to support stdin and local file system only?
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 mean support of usual protocols, like ftp, http, etc.
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.
Actually, reference to the build system of Go or Java, I think we can simply support HTTP/HTTPS. Because they're much more popular them other protocols. curl http://stuff/to/download | docker-compose -f - is just a little bit long. And you know what, the container version of docker-compose cannot even read stdin properly. I think that's a bug but this can be a reason for us to consider the improvement.
06e0cb6
to
de30c6d
Compare
Related to #1818 (comment) I like the idea, but I don't think we should overload |
with open(filename, 'r') as fh: | ||
return yaml.safe_load(fh) | ||
if is_compose_url(filename): | ||
return yaml.safe_load(urllib.urlopen(filename)) |
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 is going to need a lot more error handling. There are a lot of failures that can happen here.
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.
Allow error handling by response.raise_for_status()
+1 for |
I'd really like to use this, but it looks like the builds are broken right now, and just by minor things: a too long line in the tests and incorrectly ordered imports. @yongjhih, any chance you could fix those up soon? |
bbed36e
to
f5f6c61
Compare
I used to |
ca6b0aa
to
798a33f
Compare
5773d1b
to
6f9b828
Compare
Please sign your commits following these rules: $ git clone -b "config" git@github.com:yongjhih/docker-compose.git somewhere
$ cd somewhere
$ git rebase -i HEAD~2
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f Ammending updates the existing PR. You DO NOT need to open a new one. |
2 similar comments
Please sign your commits following these rules: $ git clone -b "config" git@github.com:yongjhih/docker-compose.git somewhere
$ cd somewhere
$ git rebase -i HEAD~2
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f Ammending updates the existing PR. You DO NOT need to open a new one. |
Please sign your commits following these rules: $ git clone -b "config" git@github.com:yongjhih/docker-compose.git somewhere
$ cd somewhere
$ git rebase -i HEAD~2
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f Ammending updates the existing PR. You DO NOT need to open a new one. |
For example: docker-compose -f https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml up Signed-off-by: Andrew Chen <yongjhih@gmail.com>
+1 to previous reviews, --url should be the best option here, so in general, it looks good, but please consider to use different flag. |
@pimterry |
For example: