Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use basic auth if available

  • Loading branch information...
commit 959b26d2134de0b551716825a6d850020f08972e 1 parent f0cf411
Corey Donohoe authored

Showing 1 changed file with 14 additions and 1 deletion. Show diff stats Hide diff stats

  1. 15  src/robot.coffee
15  src/robot.coffee
@@ -24,10 +24,10 @@ class Robot
24 24
     @listeners   = []
25 25
     @loadPaths   = []
26 26
     @enableSlash = false
27  
-    @connect     = Connect()
28 27
 
29 28
     @logger      = new Log process.env.HUBOT_LOG_LEVEL or "info"
30 29
 
  30
+    @setupConnect()
31 31
     @loadAdapter adapterPath, adapter if adapter?
32 32
 
33 33
   # Public: Specify a router and callback to register as Connect middleware.
@@ -143,6 +143,19 @@ class Robot
143 143
     for script in scripts
144 144
       @loadFile path, script
145 145
 
  146
+  # Setup the Connect server's defaults
  147
+  #
  148
+  # Sets up basic authentication if parameters are provided
  149
+  #
  150
+  # Returns: nothing.
  151
+  setupConnect: () ->
  152
+    user = process.env.CONNECT_USER
  153
+    pass = process.env.CONNECT_PASSWORD
  154
+
  155
+    @connect = Connect()
  156
+    if user and pass
  157
+      @connect.use Connect.basicAuth(user, path)
  158
+
146 159
   # Load the adapter Hubot is going to use.
147 160
   #
148 161
   # path    - A String of the path to adapter if local.

0 notes on commit 959b26d

Please sign in to comment.
Something went wrong with that request. Please try again.