Read runtime configuration from datastore.
[kraftakt.git] / kraftakt.go
index e0ad321..69815c2 100644 (file)
@@ -28,6 +28,10 @@ func init() {
        http.HandleFunc("/google/setup", googleSetupHandler)
        http.Handle("/google/grant", AuthenticatedHandler(googleGrantHandler))
        http.Handle("/", AuthenticatedHandler(indexHandler))
+
+       if err := app.LoadConfig(context.Background()); err != nil {
+               panic(err)
+       }
 }
 
 // ContextHandler implements http.Handler
@@ -171,7 +175,7 @@ func fitbitNotifyHandler(ctx context.Context, w http.ResponseWriter, r *http.Req
        // this is used when setting up a new subscriber in the UI. Once set
        // up, this code path should not be triggered.
        if verify := r.FormValue("verify"); verify != "" {
-               if verify == "@FITBIT_SUBSCRIBER_CODE@" {
+               if verify == app.Config.FitbitSubscriberCode {
                        w.WriteHeader(http.StatusNoContent)
                } else {
                        w.WriteHeader(http.StatusNotFound)