Permalink
Browse files

use basic auth if available

  • Loading branch information...
1 parent f0cf411 commit 959b26d2134de0b551716825a6d850020f08972e @atmos atmos committed Dec 24, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/robot.coffee
View
@@ -24,10 +24,10 @@ class Robot
@listeners = []
@loadPaths = []
@enableSlash = false
- @connect = Connect()
@logger = new Log process.env.HUBOT_LOG_LEVEL or "info"
+ @setupConnect()
@loadAdapter adapterPath, adapter if adapter?
# Public: Specify a router and callback to register as Connect middleware.
@@ -143,6 +143,19 @@ class Robot
for script in scripts
@loadFile path, script
+ # Setup the Connect server's defaults
+ #
+ # Sets up basic authentication if parameters are provided
+ #
+ # Returns: nothing.
+ setupConnect: () ->
+ user = process.env.CONNECT_USER
+ pass = process.env.CONNECT_PASSWORD
+
+ @connect = Connect()
+ if user and pass
+ @connect.use Connect.basicAuth(user, path)
+
# Load the adapter Hubot is going to use.
#
# path - A String of the path to adapter if local.

0 comments on commit 959b26d

Please sign in to comment.