@@ -46,7 +46,7 @@ type KeyStore interface {
46
46
GetDecrypter (ctx context.Context , keyPair * types.EncryptionKeyPair ) (crypto.Decrypter , error )
47
47
}
48
48
49
- // A Cache fetches a cached *recordingencryptionv1.RecordingEncryption
49
+ // A Cache fetches a cached [ *recordingencryptionv1.RecordingEncryption]
50
50
type Cache interface {
51
51
GetRecordingEncryption (context.Context ) (* recordingencryptionv1.RecordingEncryption , error )
52
52
}
@@ -61,26 +61,23 @@ type ManagerConfig struct {
61
61
LockConfig backend.RunWhileLockedConfig
62
62
}
63
63
64
- // NewManager returns a new Manager using the given ManagerConfig.
64
+ // NewManager returns a new Manager using the given [ ManagerConfig] .
65
65
func NewManager (cfg ManagerConfig ) (* Manager , error ) {
66
-
67
66
switch {
68
67
case cfg .Backend == nil :
69
68
return nil , trace .BadParameter ("backend is required" )
70
69
case cfg .ClusterConfig == nil :
71
70
return nil , trace .BadParameter ("cluster config is required" )
72
71
case cfg .KeyStore == nil :
73
72
return nil , trace .BadParameter ("key store is required" )
73
+ case cfg .Cache == nil :
74
+ return nil , trace .BadParameter ("cache is required" )
74
75
}
75
76
76
77
if cfg .Logger == nil {
77
78
cfg .Logger = slog .With (teleport .ComponentKey , "recording-encryption-manager" )
78
79
}
79
80
80
- if cfg .Cache == nil {
81
- cfg .Cache = cfg .Backend
82
- }
83
-
84
81
return & Manager {
85
82
RecordingEncryption : cfg .Backend ,
86
83
ClusterConfigurationInternal : cfg .ClusterConfig ,
@@ -177,7 +174,7 @@ func (m *Manager) UpsertSessionRecordingConfig(ctx context.Context, cfg types.Se
177
174
return sessionRecordingConfig , trace .Wrap (err )
178
175
}
179
176
180
- // SetCache overwrites the configured Cache implementation
177
+ // SetCache overwrites the configured Cache implementation. It should only be called if the `Manager` is not in use.
181
178
func (m * Manager ) SetCache (cache Cache ) {
182
179
m .cache = cache
183
180
}
0 commit comments