Envelope encryption CLI migration command (#41454)

* Working version of migrate secrets CLI command

* Move user oauth info encryption away from db transaction

* Enable a mechanism for re-use db session on encryption

* De-duplicate shared code between db and runner commands

* Set up Wire build graph

* Remove enterprise Wire set

* Fix cylic dependency: sqlstore.DBSession <-> xorm.Session

* Minor fix (add missing base64 encoding)

* Extract CLI 'secrets-migration' commands from 'data-migration' ones

* Move runner package outside commands

* Update Makefile (gen-go path)

* Minor prettier fix

* Some minor XORM related refactors

* Include new Wire enterprise file into .gitignore

* Update Wire deps

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

Co-authored-by: Tania B <yalyna.ts@gmail.com>
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
This commit is contained in:
Joan López de la Franca Beltran
2021-11-18 09:19:04 +01:00
committed by GitHub
parent 1be9a61f43
commit 0c280319af
3 changed files with 222 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ package runner
import (
"github.com/grafana/grafana/pkg/services/encryption"
"github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/services/secrets/manager"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
)
@@ -12,11 +12,11 @@ type Runner struct {
SQLStore *sqlstore.SQLStore
SettingsProvider setting.Provider
EncryptionService encryption.Internal
SecretsService secrets.Service
SecretsService *manager.SecretsService
}
func New(cfg *setting.Cfg, sqlStore *sqlstore.SQLStore, settingsProvider setting.Provider,
encryptionService encryption.Internal, secretsService secrets.Service) Runner {
encryptionService encryption.Internal, secretsService *manager.SecretsService) Runner {
return Runner{
Cfg: cfg,
SQLStore: sqlStore,