photos-ui: move to bazel
diff --git a/apps/photos-ui/main.go b/apps/photos-ui/main.go
index b85036e..e170a73 100644
--- a/apps/photos-ui/main.go
+++ b/apps/photos-ui/main.go
@@ -8,13 +8,19 @@
 	"net/http/httputil"
 	"net/url"
 	"text/template"
+
+	"github.com/bazelbuild/rules_go/go/tools/bazel"
 )
 
 var port = flag.Int("port", 3000, "Port to listen on.")
 var pcloudApiAddr = flag.String("pcloud_api_addr", "", "PCloud API Server address.")
 
 func handle_gallery(w http.ResponseWriter, r *http.Request) {
-	http.ServeFile(w, r, "./gallery.html")
+	gallery_html, err := bazel.Runfile("apps/photos-ui/gallery.html")
+	if err != nil {
+		http.Error(w, err.Error(), http.StatusInternalServerError)
+	}
+	http.ServeFile(w, r, gallery_html)
 }
 
 func handle_photo(w http.ResponseWriter, r *http.Request) {
@@ -28,7 +34,11 @@
 		http.Error(w, "Photo id must be provided", http.StatusBadRequest)
 		return
 	}
-	t, err := template.ParseFiles("photo.html")
+	photo_html, err := bazel.Runfile("apps/photos-ui/photo.html")
+	if err != nil {
+		http.Error(w, err.Error(), http.StatusInternalServerError)
+	}
+	t, err := template.ParseFiles(photo_html)
 	if err != nil {
 		log.Print(err)
 		http.Error(w, "Could not process page", http.StatusInternalServerError)
@@ -52,7 +62,11 @@
 
 func main() {
 	flag.Parse()
-	fs := http.FileServer(http.Dir("./static"))
+	static_dir, err := bazel.Runfile("apps/photos-ui/static")
+	if err != nil {
+		log.Fatal(err)
+	}
+	fs := http.FileServer(http.Dir(static_dir))
 	http.Handle("/static/", http.StripPrefix("/static/", fs))
 	http.Handle("/graphql", newGqlProxy(*pcloudApiAddr))
 	http.HandleFunc("/photo", handle_photo)