Skip to content

Commit

Permalink
Move wget-hsts to XDG_CACHE_HOME
Browse files Browse the repository at this point in the history
Addresses #17
 - Adds an alias for `wget` that adds `--hsts-file` option pointing to
   file in `XDG_CACHE_HOME`
 - The alias is added to `.zshenv` even though it's not a good practice
   to modify command behavior in it
 - The rationale is that we want to prevent all executions from creating
   the file in `$HOME`, other that that it still behaves as regular wget

After setting this alias it's safe to just move/rename existing
`~/.wget-hsts` file to `$XDG_CACHE_HOME/wget-hsts`.
  • Loading branch information
matyama committed Apr 8, 2022
1 parent 256eca0 commit 37ab61d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ export FD_CONFIG_HOME=${XDG_CONFIG_HOME}/fd
export RIPGREP_CONFIG_HOME="${XDG_CONFIG_HOME}/rg"
export RIPGREP_CONFIG_PATH=${RIPGREP_CONFIG_HOME}/ripgreprc

# wget
# - Despite the fact it's not recommended to override command behavior in
# `.envrc` (since it's always loaded, even for non-interactive shells), here
# we actually want to prevent all executions from creating `~/.wget-hsts`
# - An alternative is to set `hsts-file` in `WGETRC` but it must use an absolute
# path, i.e. cannot dynamically change with `XDG_CACHE_HOME`
# - See: https://wiki.archlinux.org/title/XDG_Base_Directory
# - Uncomment `WGETRC` if it's present and should be used
#export WGETRC=${XDG_CONFIG_HOME}/wgetrc
alias wget="wget --hsts-file=${XDG_CACHE_HOME}/wget-hsts"

# Dungeon Crawl Stone Soup
# - Note: the trailing slash is required
# - See: https://wiki.archlinux.org/title/XDG_Base_Directory
Expand Down

0 comments on commit 37ab61d

Please sign in to comment.