curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

curl config file based on domain or inline variables based on request

From: Bastian Jesuiter via curl-users <curl-users_at_lists.haxx.se>
Date: Thu, 11 Dec 2025 10:39:58 +0100

Hi,

Just had a thought.

I regularly find myself using curl with authorization bearer tokens.
However since I cannot use .netrc for bearer tokens,
I tried to find another solution to automatically add them without needing
to include them manually each time.

The idea is to potentially use a combination of curlrc + file based headers
with -H _at_file

The curlrc would include the a header with a {{ domain }} like variable
syntax.

Like:
header _at_path/{{domain}}.txt

Where the domain will be inferred by the given domain in the command.

Example:
curl --url "https://example.com" --header _at_curl/{{domain}}.txt

Where domain resolves to example.com automatically. Because then I could
put the --header arg into curlrc.

Alternatively, what if _at_file could link to a bashscript to make this
dynamic?

Although a bash script might have insane security implications I do not
forsee at the moment.

Thanks

Bastian


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-12-11