hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Add default config file feature

Open lepapareil opened this issue 11 months ago • 6 comments

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

lepapareil avatar Jan 22 '25 12:01 lepapareil

We can support $XDG_CONFIG_HOME/hurlrc

fabricereix avatar Feb 07 '25 15:02 fabricereix

On Windows perhaps we can use standard %USERPROFILE% var ?

lepapareil avatar Feb 07 '25 15:02 lepapareil

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

fabricereix avatar May 28 '25 07:05 fabricereix

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

jcamiel avatar May 28 '25 07:05 jcamiel

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 !

lepapareil avatar May 28 '25 07:05 lepapareil

we can even add one if we add the option --config (same as curl) (just before comand-line)

fabricereix avatar May 28 '25 07:05 fabricereix