package app import ( "context" "sync" "google.golang.org/appengine/datastore" "google.golang.org/appengine/log" ) var Config struct { ProjectNumber string FitbitClientID string FitbitClientSecret string FitbitSubscriberCode string GoogleClientID string GoogleClientSecret string } var mu sync.Mutex func LoadConfig(ctx context.Context) error { mu.Lock() defer mu.Unlock() if Config.ProjectNumber != "" { return nil } key := datastore.NewKey(ctx, "Config", "Production", 0, nil) if err := datastore.Get(ctx, key, &Config); err != nil { log.Errorf(ctx, `datastore.Get("Config", "Production") = %v`, err) return err } return nil }