Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: metric env not affect (#2450)

Athurg Gooth4f1bb55e55b4
diff --git a/cmd/memos.go b/cmd/memos.go
index dd4ef3171..c391d35e2 100644
--- a/cmd/memos.go
+++ b/cmd/memos.go
@@ -66,9 +66,12 @@ var (
return
}
- if enableMetric {
+ if profile.Metric {
+ println("metric collection is enabled")
// nolint
metric.NewMetricClient(s.ID, *profile)
+ } else {
+ println("metric collection is disabled")
}
c := make(chan os.Signal, 1)
@@ -169,6 +172,7 @@ func initConfig() {
println("mode:", profile.Mode)
println("driver:", profile.Driver)
println("version:", profile.Version)
+ println("metric:", profile.Metric)
println("---")
}
diff --git a/server/profile/profile.go b/server/profile/profile.go
index cdac30d58..1c21e9df5 100644
--- a/server/profile/profile.go
+++ b/server/profile/profile.go
@@ -30,6 +30,8 @@ type Profile struct {
Driver string `json:"-"`
// Version is the current version of server
Version string `json:"version"`
+ // Metric indicate the metric collection is enabled or not
+ Metric bool `json:"-"`
}
func (p *Profile) IsDev() bool {