summaryrefslogtreecommitdiff
path: root/src/Propellor/Gpg.hs
diff options
context:
space:
mode:
authorJoey Hess2016-01-03 16:56:00 -0400
committerJoey Hess2016-01-03 16:56:00 -0400
commitf86804fa27a2cf5b1972b14ab41e81edb85ad661 (patch)
tree11753dde33d0e6dd85feae84a727846fb6a3d088 /src/Propellor/Gpg.hs
parentb13e3f8d55c1b74123186c3178922b0809367f76 (diff)
refactor into smaller modules to untangle git and gpg modules
Diffstat (limited to 'src/Propellor/Gpg.hs')
-rw-r--r--src/Propellor/Gpg.hs15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs
index 0fd8c9ce..d3550e88 100644
--- a/src/Propellor/Gpg.hs
+++ b/src/Propellor/Gpg.hs
@@ -13,7 +13,7 @@ import Prelude
import Propellor.PrivData.Paths
import Propellor.Message
-import Utility.Exception
+import Propellor.Git.Config
import Utility.SafeCommand
import Utility.Process
import Utility.Monad
@@ -22,6 +22,8 @@ import Utility.Tmp
import Utility.FileSystemEncoding
import Utility.Env
+type KeyId = String
+
getGpgBin :: IO String
getGpgBin = do
gitGpgBin <- getGitConfigValue "gpg.program"
@@ -29,8 +31,6 @@ getGpgBin = do
Nothing -> getEnvDefault "GNUPGBIN" "gpg"
Just b -> return b
-type KeyId = String
-
keyring :: FilePath
keyring = privDataDir </> "keyring.gpg"
@@ -118,15 +118,6 @@ reencryptPrivData = ifM (doesFileExist privDataFile)
, return True
)
-getGitConfigValue :: String -> IO (Maybe String)
-getGitConfigValue key = do
- value <- catchMaybeIO $
- takeWhile (/= '\n')
- <$> readProcess "git" ["config", key]
- return $ case value of
- Just v | not (null v) -> Just v
- _ -> Nothing
-
gitAdd :: FilePath -> IO Bool
gitAdd f = boolSystem "git"
[ Param "add"