use P2P auth for git-remote-tor-annex
This changes the environment variable name to the more generic GIT_ANNEX_P2P_AUTHTOKEN. This commit was sponsored by andrea rota.
This commit is contained in:
parent
3ab12ba923
commit
b88e44ea9a
4 changed files with 18 additions and 23 deletions
|
@ -8,26 +8,8 @@
|
|||
module Remote.Helper.Tor where
|
||||
|
||||
import Annex.Common
|
||||
import Utility.AuthToken
|
||||
import Creds
|
||||
import Utility.Tor
|
||||
import Utility.Env
|
||||
|
||||
import Network.Socket
|
||||
import qualified Data.Text as T
|
||||
|
||||
-- Read the first line of the creds file. Environment variable overrides.
|
||||
getTorAuthTokenFor :: OnionAddress -> Annex (Maybe AuthToken)
|
||||
getTorAuthTokenFor (OnionAddress onionaddress) =
|
||||
maybe Nothing mk <$> getM id
|
||||
[ liftIO $ getEnv torAuthTokenEnv
|
||||
, readCacheCreds onionaddress
|
||||
]
|
||||
where
|
||||
mk = toAuthToken . T.pack . takeWhile (/= '\n')
|
||||
|
||||
torAuthTokenEnv :: String
|
||||
torAuthTokenEnv = "GIT_ANNEX_TOR_AUTHTOKEN"
|
||||
|
||||
torHandle :: Socket -> IO Handle
|
||||
torHandle s = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue