config.d 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  2. SPDX-License-Identifier: curl
  3. Long: config
  4. Arg: <file>
  5. Help: Read config from a file
  6. Short: K
  7. Category: curl
  8. Example: --config file.txt $URL
  9. Added: 4.10
  10. See-also: disable
  11. Multi: append
  12. ---
  13. Specify a text file to read curl arguments from. The command line arguments
  14. found in the text file will be used as if they were provided on the command
  15. line.
  16. Options and their parameters must be specified on the same line in the file,
  17. separated by whitespace, colon, or the equals sign. Long option names can
  18. optionally be given in the config file without the initial double dashes and
  19. if so, the colon or equals characters can be used as separators. If the option
  20. is specified with one or two dashes, there can be no colon or equals character
  21. between the option and its parameter.
  22. If the parameter contains whitespace (or starts with : or =), the parameter
  23. must be enclosed within quotes. Within double quotes, the following escape
  24. sequences are available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash
  25. preceding any other letter is ignored.
  26. If the first column of a config line is a '#' character, the rest of the line
  27. will be treated as a comment.
  28. Only write one option per physical line in the config file.
  29. Specify the filename to --config as '-' to make curl read the file from stdin.
  30. Note that to be able to specify a URL in the config file, you need to specify
  31. it using the --url option, and not by simply writing the URL on its own
  32. line. So, it could look similar to this:
  33. url = "https://curl.se/docs/"
  34. # --- Example file ---
  35. # this is a comment
  36. url = "example.com"
  37. output = "curlhere.html"
  38. user-agent = "superagent/1.0"
  39. # and fetch another URL too
  40. url = "example.com/docs/manpage.html"
  41. -O
  42. referer = "http://nowhereatall.example.com/"
  43. # --- End of example file ---
  44. When curl is invoked, it (unless --disable is used) checks for a default
  45. config file and uses it if found, even when --config is used. The default
  46. config file is checked for in the following places in this order:
  47. 1) "$CURL_HOME/.curlrc"
  48. 2) "$XDG_CONFIG_HOME/.curlrc" (Added in 7.73.0)
  49. 3) "$HOME/.curlrc"
  50. 4) Windows: "%USERPROFILE%\\.curlrc"
  51. 5) Windows: "%APPDATA%\\.curlrc"
  52. 6) Windows: "%USERPROFILE%\\Application Data\\.curlrc"
  53. 7) Non-Windows: use getpwuid to find the home directory
  54. 8) On Windows, if it finds no .curlrc file in the sequence described above, it
  55. checks for one in the same dir the curl executable is placed.
  56. On Windows two filenames are checked per location: .curlrc and _curlrc,
  57. preferring the former. Older versions on Windows checked for _curlrc only.