debug-me 1.20170505 → 1.20170509
raw patch · 8 files changed
+41/−7 lines, 8 files
Files
- CHANGELOG +14/−0
- Hash.hs +1/−1
- Log.hs +1/−1
- Server.hs +11/−2
- WebSockets.hs +3/−1
- debug-me.1 +5/−0
- debug-me.cabal +2/−2
- debug-me.default +4/−0
CHANGELOG view
@@ -1,3 +1,17 @@+debug-me (1.20170509) unstable; urgency=medium++ * Server: Use "postmaster" as default --from-email address+ rather than "unknown@server".+ * Server: DEBUG_ME_FROM_EMAIL can be used to specify the --from-email.+ This is used in debug-me.default to encourage configuring it.+ Thanks, Sean Whitton.+ * Avoid crash when --use-server is given an url that does not+ include a path.+ * Fix bug that prevented creating ~/.debug-me/log/remote/+ when ~/.debug-me/ didn't already exist.++ -- Joey Hess <id@joeyh.name> Tue, 09 May 2017 19:20:32 -0400+ debug-me (1.20170505) unstable; urgency=medium * First release of debug-me.
Hash.hs view
@@ -84,7 +84,7 @@ hash = hash . B.concat . map (val . hashValue) -- | Hash empty string for Nothing-instance Hashable v => Hashable (Maybe v) where+instance Hashable (Maybe Hash) where hash Nothing = hash () hash (Just v) = hash v
Log.hs view
@@ -68,7 +68,7 @@ setup = do basedir <- logDir let dir = maybe basedir (basedir </>) subdir- createDirectoryIfMissing False dir+ createDirectoryIfMissing True dir return $ sessionLogFile dir sessionid cleanup logfile = putStrLn $ "** debug-me session was logged to " ++ logfile go logfile = withFile logfile WriteMode (a . mkLogger)
Server.hs view
@@ -33,6 +33,7 @@ import System.Directory import System.Mem.Weak import Network.Mail.Mime+import System.Environment type ServerState = M.Map SessionID Session @@ -95,7 +96,9 @@ closeSession (Session bchan _ _) = closeTMChan bchan server :: ServerOpts -> IO ()-server o = runSettings settings . app o =<< newServerState+server o = do+ o' <- checkEnv o+ runSettings settings . app o' =<< newServerState where settings = -- Prefer IPv6 but allow IPv4 as well@@ -105,6 +108,12 @@ setPort (serverPort o) $ defaultSettings +checkEnv :: ServerOpts -> IO ServerOpts+checkEnv o = go <$> lookupEnv "DEBUG_ME_FROM_EMAIL"+ where+ go Nothing = o+ go (Just email) = o { serverEmail = Just (T.pack email) }+ app :: ServerOpts -> TVar ServerState -> Application app o ssv = websocketsOr connectionOptions (websocketApp o ssv) webapp where@@ -262,7 +271,7 @@ | otherwise = return () where to = Address Nothing email- from = Address Nothing $ fromMaybe "unknown@server" (serverEmail o)+ from = Address Nothing $ fromMaybe "postmaster" (serverEmail o) subject = "Your recent debug-me session" body = "Attached is the log from your recent debug-me session." isemail = "@" `T.isInfixOf` email
WebSockets.hs view
@@ -144,7 +144,9 @@ port = case uriPort serverauth of (':':s) -> fromMaybe 80 (readMaybe s) _ -> 80- endpoint = uriPath serverurl+ endpoint = case uriPath serverurl of+ [] -> "/"+ p -> p catchconnclosed ConnectionClosed = Just () catchconnclosed _ = Nothing
debug-me.1 view
@@ -88,6 +88,8 @@ .IP "--from-email address" The server will email session logs to users. It's a good idea to provide a real email address, otherwise a dummy one will be used.+You can also set the enviroment variable DEBUG_ME_FROM_EMAIL to configure+this. .IP "--delete-old-logs" Normally the server will retain old log files so that users and developers can refer to them. This option makes it delete the log file once the@@ -96,6 +98,9 @@ .IP "~/.debug-me/log/" Sessions are logged to here. The log file name is displayed when debug-me exits.+.IP "~/.debug-me/log/remote/"+When using debug-me to connect to a remote session, the session will be+logged to here. .SH SEE ALSO <https://debug-me.branchable.com/> .PP
debug-me.cabal view
@@ -1,5 +1,5 @@ Name: debug-me-Version: 1.20170505+Version: 1.20170509 Cabal-Version: >= 1.8 Maintainer: Joey Hess <joey@kitenet.net> Author: Joey Hess@@ -11,7 +11,7 @@ Build-Type: Custom Synopsis: secure remote debugging Description:- Debugging a problem over email is slow, tedious, and hard. The developer+ Debugging a problem over email/irc/BTS is slow, tedious, and hard. The developer needs to see your problem to understand it. Debug-me aims to make debugging fast, fun, and easy, by letting the developer access your computer remotely, so they can immediately see and interact with the problem. Making your
debug-me.default view
@@ -1,2 +1,6 @@+# Configure the email address that debug-me uses when emailing logs to+# users.+DEBUG_ME_FROM_EMAIL=postmaster+ # Parameters to pass to debug-me when it's started as a daemon. DAEMON_PARAMS="--server /var/log/debug-me/ --delete-old-logs"