mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 00:55:54 +08:00
chore: use the license v2 key to fill licenses v3 on startup (#6468)
* feat: use the license v2 key to fill licenses v3 on startup * chore: make the init only if the licenses v2 is present * chore: address review comments
This commit is contained in:
parent
a59e7b9dfb
commit
d93f72f18d
@ -67,6 +67,30 @@ func StartManager(dbType string, db *sqlx.DB, useLicensesV3 bool, features ...ba
|
|||||||
repo: &repo,
|
repo: &repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if useLicensesV3 {
|
||||||
|
// get active license from the db
|
||||||
|
active, err := m.repo.GetActiveLicense(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return m, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we have an active license then need to fetch the complete details
|
||||||
|
if active != nil {
|
||||||
|
// fetch the new license structure from control plane
|
||||||
|
licenseV3, apiError := validate.ValidateLicenseV3(active.Key)
|
||||||
|
if apiError != nil {
|
||||||
|
return m, apiError
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert the licenseV3 in sqlite db
|
||||||
|
apiError = m.repo.InsertLicenseV3(context.Background(), licenseV3)
|
||||||
|
// if the license already exists move ahead.
|
||||||
|
if apiError != nil && apiError.Typ != model.ErrorConflict {
|
||||||
|
return m, apiError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := m.start(useLicensesV3, features...); err != nil {
|
if err := m.start(useLicensesV3, features...); err != nil {
|
||||||
return m, err
|
return m, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user