mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 22:27:48 +00:00
add post hog api to go releaser and update cli telemetry
This commit is contained in:
@@ -46,6 +46,7 @@ jobs:
|
|||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
||||||
|
POSTHOG_API_KEY_FOR_CLI: ${{ secrets.POSTHOG_API_KEY_FOR_CLI }}
|
||||||
FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }}
|
FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }}
|
||||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
AUR_KEY: ${{ secrets.AUR_KEY }}
|
||||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ monorepo:
|
|||||||
tag_prefix: infisical-cli/
|
tag_prefix: infisical-cli/
|
||||||
dir: cli
|
dir: cli
|
||||||
|
|
||||||
|
env:
|
||||||
|
- POSTHOG_API_KEY_FOR_CLI={{ .Env.POSTHOG_API_KEY_FOR_CLI }}
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- id: darwin-build
|
- id: darwin-build
|
||||||
binary: infisical
|
binary: infisical
|
||||||
|
|||||||
@@ -14,11 +14,17 @@ type Telemetry struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewTelemetry(telemetryIsEnabled bool) *Telemetry {
|
func NewTelemetry(telemetryIsEnabled bool) *Telemetry {
|
||||||
client, _ := posthog.NewWithConfig(
|
posthogAPIKey := os.Getenv("POSTHOG_API_KEY_FOR_CLI")
|
||||||
os.Getenv("POSTHOG_API_KEY_FOR_CLI"),
|
if posthogAPIKey != "" {
|
||||||
posthog.Config{},
|
client, _ := posthog.NewWithConfig(
|
||||||
)
|
posthogAPIKey,
|
||||||
return &Telemetry{isEnabled: telemetryIsEnabled, posthogClient: client}
|
posthog.Config{},
|
||||||
|
)
|
||||||
|
|
||||||
|
return &Telemetry{isEnabled: telemetryIsEnabled, posthogClient: client}
|
||||||
|
} else {
|
||||||
|
return &Telemetry{isEnabled: false}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Telemetry) CaptureEvent(eventName string, properties posthog.Properties) {
|
func (t *Telemetry) CaptureEvent(eventName string, properties posthog.Properties) {
|
||||||
@@ -33,9 +39,9 @@ func (t *Telemetry) CaptureEvent(eventName string, properties posthog.Properties
|
|||||||
Event: eventName,
|
Event: eventName,
|
||||||
Properties: properties,
|
Properties: properties,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
defer t.posthogClient.Close()
|
defer t.posthogClient.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Telemetry) GetDistinctId() (string, error) {
|
func (t *Telemetry) GetDistinctId() (string, error) {
|
||||||
@@ -55,7 +61,7 @@ func (t *Telemetry) GetDistinctId() (string, error) {
|
|||||||
if userDetails.IsUserLoggedIn && userDetails.UserCredentials.Email != "" {
|
if userDetails.IsUserLoggedIn && userDetails.UserCredentials.Email != "" {
|
||||||
distinctId = userDetails.UserCredentials.Email
|
distinctId = userDetails.UserCredentials.Email
|
||||||
} else if machineId != "" {
|
} else if machineId != "" {
|
||||||
distinctId = "anonymous_cli" + machineId
|
distinctId = "anonymous_cli_" + machineId
|
||||||
} else {
|
} else {
|
||||||
distinctId = ""
|
distinctId = ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user