-
Notifications
You must be signed in to change notification settings - Fork 115
/
complex_settings_source.go
45 lines (36 loc) · 1.03 KB
/
complex_settings_source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package infrastructure
import (
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
)
type ComplexSettingsSource struct {
metadataService MetadataService
registryProvider RegistryProvider
logTag string
logger boshlog.Logger
}
func NewComplexSettingsSource(
metadataService MetadataService,
registryProvider RegistryProvider,
logger boshlog.Logger,
) ComplexSettingsSource {
return ComplexSettingsSource{
metadataService: metadataService,
registryProvider: registryProvider,
logTag: "ComplexSettingsSource",
logger: logger,
}
}
func (s ComplexSettingsSource) PublicSSHKeyForUsername(string) (string, error) {
return s.metadataService.GetPublicKey()
}
func (s ComplexSettingsSource) Settings() (boshsettings.Settings, error) {
registry, err := s.registryProvider.GetRegistry()
if err != nil {
return boshsettings.Settings{}, err
}
return registry.GetSettings()
}
func (s ComplexSettingsSource) GetMetadataService() MetadataService {
return s.metadataService
}