load environment variables by default
[linksys-wrt3g-tools.git] / Wrt3g / Config.php
index f8b96492fe8620583c1ddd6a312d18256ceb949d..5036f7d0a2266e2f32d4e0b9f0beb8320cdef730 100644 (file)
@@ -80,12 +80,28 @@ class Wrt3g_Config
      */
     public function load($options = array())
     {
+        //system config file
+        $this->loadFromFile('/etc/linksys-wrt3g-tools');
+
+        //user config file
         $file = $this->getConfigFilePath();
         if ($file) {
             $this->loadFromFile($file);
         }
+        //environment variables: we use lowercase options, which should
+        // not collide with the uppercase env variables like USER
+        $this->loadOptions($_SERVER);
+        //commandline options
         $this->loadOptions($options);
 
+        $this->logger->log(
+            sprintf(
+                "Configuration: %s:%s@%s",
+                $this->user, $this->password, $this->host
+            ),
+            2
+        );
+
         if (isset($options['save'])) {
             $this->save($file);
         }