Talk about installation and --dry-run
[shpub.git] / src / shpub / Config / Host.php
index 6ef05d971d6064862b74b561a886941e19866aed..f3214e29f8aea0da558b15d4ea2c074bd5798189 100644 (file)
@@ -25,11 +25,11 @@ class Config_Host
     public $token;
 
     /**
-     * Host information cache
+     * Host information
      *
-     * @var Config_HostCache
+     * @var Config_HostEndpoints
      */
-    public $cache;
+    public $endpoints;
 
     /**
      * If this host is the default one
@@ -37,5 +37,23 @@ class Config_Host
      * @var boolean
      */
     public $default;
+
+    public function __construct()
+    {
+        $this->endpoints = new Config_Endpoints();
+    }
+
+    public function loadEndpoints()
+    {
+        $this->endpoints = new Config_Endpoints();
+        $this->endpoints->load($this->server);
+        if ($this->endpoints->incomplete()) {
+            $this->endpoints->discover($this->server);
+            if ($this->token) {
+                $this->endpoints->discoverMedia($this->token);
+            }
+            $this->endpoints->save($this->server);
+        }
+    }
 }
 ?>