Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable Registry and Config access token #772

Merged
merged 2 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app-service-template/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ Protocol = 'http'
ReadMaxLimit = 100
StartupMsg = 'new-app-service Application Service has started'
Timeout = '30s'
ConfigAccessTokenFile = '/tmp/edgex/secrets/new-app-service/consul-token' # ignored in non-secure mode

[Registry]
Host = 'localhost'
Port = 8500
Type = 'consul'
AccessTokenFile = '/tmp/edgex/secrets/new-app-service/consul-token' # ignored in non-secure mode

[Database]
Type = "redisdb"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690
github.com/diegoholiveira/jsonlogic v1.0.1-0.20200220175622-ab7989be08b9
github.com/eclipse/paho.mqtt.golang v1.3.2
github.com/edgexfoundry/go-mod-bootstrap/v2 v2.0.0-dev.22
github.com/edgexfoundry/go-mod-bootstrap/v2 v2.0.0-dev.27
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0-dev.62
github.com/edgexfoundry/go-mod-messaging/v2 v2.0.0-dev.6
github.com/edgexfoundry/go-mod-registry/v2 v2.0.0-dev.3
github.com/edgexfoundry/go-mod-registry/v2 v2.0.0-dev.4
github.com/fxamacker/cbor/v2 v2.2.0
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/uuid v1.2.0
Expand Down
40 changes: 21 additions & 19 deletions internal/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ type ConfigurationStruct struct {

// ServiceInfo is used to hold and configure various settings related to the hosting of this service
type ServiceInfo struct {
BootTimeout string
CheckInterval string
Host string
HTTPSCert string
HTTPSKey string
ServerBindAddr string
Port int
Protocol string
StartupMsg string
ReadMaxLimit int
Timeout string
BootTimeout string
CheckInterval string
Host string
HTTPSCert string
HTTPSKey string
ServerBindAddr string
Port int
Protocol string
StartupMsg string
ReadMaxLimit int
Timeout string
ConfigAccessTokenFile string
}

// TriggerInfo contains Metadata associated with each Trigger
Expand Down Expand Up @@ -196,14 +197,15 @@ func (c *ConfigurationStruct) GetInsecureSecrets() bootstrapConfig.InsecureSecre
// transformToBootstrapServiceInfo transforms the SDK's ServiceInfo to the bootstrap's version of ServiceInfo
func (c *ConfigurationStruct) transformToBootstrapServiceInfo() bootstrapConfig.ServiceInfo {
return bootstrapConfig.ServiceInfo{
BootTimeout: durationToMill(c.Service.BootTimeout),
CheckInterval: c.Service.CheckInterval,
Host: c.Service.Host,
Port: c.Service.Port,
Protocol: c.Service.Protocol,
StartupMsg: c.Service.StartupMsg,
MaxResultCount: c.Service.ReadMaxLimit,
Timeout: durationToMill(c.Service.Timeout),
BootTimeout: durationToMill(c.Service.BootTimeout),
CheckInterval: c.Service.CheckInterval,
Host: c.Service.Host,
Port: c.Service.Port,
Protocol: c.Service.Protocol,
StartupMsg: c.Service.StartupMsg,
MaxResultCount: c.Service.ReadMaxLimit,
Timeout: durationToMill(c.Service.Timeout),
ConfigAccessTokenFile: c.Service.ConfigAccessTokenFile,
}
}

Expand Down