Add default config file feature
Problem to solve
Getting default configuration without updating any Hurl file, exec Hurl command line, exec Hurl script or Hurl variable file.
Proposal
Use ~/.hurlrc as curl does with ~/.curlrc => https://everything.curl.dev/cmdline/configfile.html#default-config-file
We can support $XDG_CONFIG_HOME/hurlrc
On Windows perhaps we can use standard %USERPROFILE% var ?
Relating to the precedence between environment variables and config file.
Defining proxy in curl config file (~/.curlrc) seems to take precedence over environment variable http_proxy (But it could be specific to this specific option)
$ export http_proxy=xxx
$ curl http://google.fr => hanging
$ cat >~/.curlrc <<END
proxy = localhost:8080
END
$ curl http://google.fr
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.fr/">here</A>.
</BODY></HTML>
Though I was a bit surprised by this behavior, I think we can follow the same rule. Therefore, the order of precedence would be for Hurl options:
- default hard-coded options in binary
- environment variables / terminal
- config file
- command-line
Great, we can update with :
- default hard-coded options in binary
- environment variables / terminal
- config file
- command-line
- (file options sections - to be implemented)
- request options sections
Great, we can update with :
- default hard-coded options in binary
- environment variables / terminal
- config file
- command-line
- (file options sections - to be implemented)
- request options sections
Approved !
we can even add one if we add the option --config (same as curl)
(just before comand-line)