Skip to content

Commit

Permalink
refactor!: Change configuration file format to YAML
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Configuration files are now in YAML format, Defualt file name is now configuration.yaml

closes # 4452

Signed-off-by: Leonard Goodell <leonard.goodell@intel.com>
  • Loading branch information
Leonard Goodell committed Mar 20, 2023
1 parent d06f110 commit 3efd87f
Show file tree
Hide file tree
Showing 59 changed files with 510 additions and 537 deletions.
5 changes: 3 additions & 2 deletions cmd/core-command/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ----------------------------------------------------------------------------------
# Copyright 2018 Dell Technologies, Inc.
# Copyright 2018 Cavium
# Copyright 2023 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +37,7 @@ FROM alpine:3.17
RUN apk add --update --no-cache dumb-init

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2021: Intel Corporation'
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2023: Intel Corporation'

ENV APP_PORT=59882
#expose command data port
Expand All @@ -46,7 +47,7 @@ WORKDIR /
COPY --from=builder /edgex-go/Attribution.txt /
COPY --from=builder /edgex-go/security.txt /
COPY --from=builder /edgex-go/cmd/core-command/core-command /
COPY --from=builder /edgex-go/cmd/core-command/res/configuration.toml /res/configuration.toml
COPY --from=builder /edgex-go/cmd/core-command/res/configuration.yaml /res/configuration.yaml

ENTRYPOINT ["/core-command"]
CMD ["-cp=consul.http://edgex-core-consul:8500", "--registry"]
45 changes: 0 additions & 45 deletions cmd/core-command/res/configuration.toml

This file was deleted.

48 changes: 48 additions & 0 deletions cmd/core-command/res/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Writable:
LogLevel: INFO
InsecureSecrets:
mqtt:
SecretName: mqtt
SecretData:
username: ""
password: ""
cacert: ""
clientcert: ""
clientkey: ""
Service:
Host: localhost
Port: 59882
StartupMsg: "This is the Core Command Microservice"
Clients:
core-metadata:
Protocol: http
Host: localhost
Port: 59881
ExternalMQTT:
Enabled: false
Url: "tcp://localhost:1883"
ClientId: core-command
ConnectTimeout: 5s
AutoReconnect: true
KeepAlive: 10
QoS: 0
Retain: true
SkipCertVerify: false
SecretName: mqtt
AuthMode: none
Topics:
CommandRequestTopic: edgex/command/request/# # for subscribing to 3rd party command requests
CommandResponseTopicPrefix: edgex/command/response # for publishing responses back to 3rd party systems /<device-name>/<command-name>/<method> will be added to this publish topic prefix
CommandQueryRequestTopic: edgex/commandquery/request/# # for subscribing to 3rd party command query request
CommandQueryResponseTopic: edgex/commandquery/response # for publishing responses back to 3rd party systems

# uncomment when running from command-line in hybrid mode with -cp -o flags
#Registry:
# Host: "localhost"

MessageBus:
# Host: localhost # uncomment when running from command-line in hybrid mode
Optional:
ClientId: core-command


2 changes: 1 addition & 1 deletion cmd/core-common-config-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ RUN chmod 755 /usr/local/bin/entrypoint.sh \
&& ln -s /usr/local/bin/entrypoint.sh /

ENTRYPOINT ["entrypoint.sh"]
CMD ["/core-common-config-bootstrapper", "-cp=consul.http://edgex-core-consul:8500", "-cf=configuration.yaml"]
CMD ["/core-common-config-bootstrapper", "-cp=consul.http://edgex-core-consul:8500"]
1 change: 0 additions & 1 deletion cmd/core-common-config-bootstrapper/res/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ all-services:

Service:
HealthCheckInterval: "10s"
Host: "localhost"
ServerBindAddr: "" # Leave blank so default to Host value unless different value is needed.
MaxResultCount: 1024
MaxRequestSize: 0 # Not currently used. Defines the maximum size of http request body in bytes
Expand Down
5 changes: 3 additions & 2 deletions cmd/core-data/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ----------------------------------------------------------------------------------
# Copyright 2018 Dell Technologies, Inc.
# Copyright 2018 Cavium
# Copyright 2023 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +37,7 @@ RUN make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS cmd/core-data/core-data
FROM alpine:3.17

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2018: Dell, Cavium'
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2023: Intel Corporation'

ENV APP_PORT=59880
#expose core data port
Expand All @@ -46,7 +47,7 @@ RUN apk add --update --no-cache dumb-init
COPY --from=builder /edgex-go/Attribution.txt /
COPY --from=builder /edgex-go/security.txt /
COPY --from=builder /edgex-go/cmd/core-data/core-data /
COPY --from=builder /edgex-go/cmd/core-data/res/configuration.toml /res/configuration.toml
COPY --from=builder /edgex-go/cmd/core-data/res/configuration.yaml /res/configuration.yaml

ENTRYPOINT ["/core-data"]
CMD ["-cp=consul.http://edgex-core-consul:8500", "--registry"]
23 changes: 0 additions & 23 deletions cmd/core-data/res/configuration.toml

This file was deleted.

27 changes: 27 additions & 0 deletions cmd/core-data/res/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
MaxEventSize: 25000 # Defines the maximum event size in kilobytes
Writable:
LogLevel: "INFO"
PersistData: true
Telemetry:
Metrics: # All service's metric names must be present in this list.
EventsPersisted: false
ReadingsPersisted: false
# Tags: # Contains the service level tags to be attached to all the service's metrics
## Gateway="my-iot-gateway" # Tag must be added here or via Consul Env Override can only change existing value, not added new ones.
Service:
Port: 59880
Host: "localhost"
StartupMsg: "This is the Core Data Microservice"

# uncomment when running from command-line in hybrid mode with -cp -o flags
#Registry:
# Host: "localhost"

MessageBus:
# Host: localhost # uncomment when running from command-line in hybrid mode
Optional:
ClientId: "core-data"

Database:
# Host: "localhost" # uncomment when running from command-line in hybrid mode
Name: "coredata"
5 changes: 3 additions & 2 deletions cmd/core-metadata/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ----------------------------------------------------------------------------------
# Copyright 2018 Dell Technologies, Inc.
# Copyright 2018 Cavium
# Copyright 2023 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,7 +38,7 @@ FROM alpine:3.17
RUN apk add --update --no-cache dumb-init

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2021: Intel Corporation'
copyright='Copyright (c) 2018: Dell, Cavium, Copyright (c) 2023: Intel Corporation'

ENV APP_PORT=59881
#expose meta data port
Expand All @@ -47,7 +48,7 @@ WORKDIR /
COPY --from=builder /edgex-go/Attribution.txt /
COPY --from=builder /edgex-go/security.txt /
COPY --from=builder /edgex-go/cmd/core-metadata/core-metadata /
COPY --from=builder /edgex-go/cmd/core-metadata/res/configuration.toml /res/configuration.toml
COPY --from=builder /edgex-go/cmd/core-metadata/res/configuration.yaml /res/configuration.yaml
COPY --from=builder /edgex-go/cmd/core-metadata/res/uom.yaml /res/uom.yaml

ENTRYPOINT ["/core-metadata"]
Expand Down
23 changes: 0 additions & 23 deletions cmd/core-metadata/res/configuration.toml

This file was deleted.

27 changes: 27 additions & 0 deletions cmd/core-metadata/res/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Writable:
LogLevel: INFO
ProfileChange:
StrictDeviceProfileChanges: false
StrictDeviceProfileDeletes: false
UoM:
Validation: false
Service:
Host: localhost
Port: 59881
StartupMsg: "This is the EdgeX Core Metadata Microservice"
UoM:
UoMFile: ./res/uom.yaml

# uncomment when running from command-line in hybrid mode with -cp -o flags
#Registry:
# Host: "localhost"

MessageBus:
# Host: "localhost" # uncomment when running from command-line in hybrid mode
Optional:
ClientId: core-metadata

Database:
# Host: "localhost" # uncomment when running from command-line in hybrid mode
Name: metadata

4 changes: 2 additions & 2 deletions cmd/secrets-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Proxy configuration commands (listed below) require access to the secret store m

# OPTIONS

* **--configDir** _/path/to/directory/with/configuration.toml_ (optional)
* **--configDir** _/path/to/directory/with/configuration.yaml_ (optional)

Points to directory containing a configuration.toml file.
Points to directory containing a configuration.yaml file.

!!! edgey "EdgeX 3.0"
The `--confdir` command line option is replaced by `--configDir` in EdgeX 3.0.
Expand Down
27 changes: 0 additions & 27 deletions cmd/secrets-config/res/configuration.toml

This file was deleted.

24 changes: 24 additions & 0 deletions cmd/secrets-config/res/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#

LogLevel: DEBUG
SecretStore:
Type: vault
Protocol: http
Host: localhost
Port: 8200
CertPath: ""
CaFilePath: ""
CertFilePath: ""
KeyFilePath: ""
# for root token use: /vault/config/assets
# for service token use: /tmp/edgex/secrets/security-proxy-setup
TokenFolderPath: /vault/config/assets
# for root token use: resp-init.json
# for service token use: secrets-token.json
TokenFile: resp-init.json

# FIXME whittle this down more
10 changes: 5 additions & 5 deletions cmd/security-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------------
# Copyright 2022 Intel Corp.
# Copyright 2023 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@ RUN make cmd/security-bootstrapper/security-bootstrapper
FROM alpine:3.17

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2022 Intel Corporation'
copyright='Copyright (c) 2023 Intel Corporation'

RUN apk add --update --no-cache dumb-init su-exec

Expand All @@ -53,13 +53,13 @@ RUN chmod +x ${SECURITY_INIT_STAGING}/*.sh
COPY --from=builder /edgex-go/Attribution.txt /
COPY --from=builder /edgex-go/security.txt /
COPY --from=builder /edgex-go/cmd/security-bootstrapper/security-bootstrapper .
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res/configuration.toml ./res/
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res/configuration.yaml ./res/

# needed for bootstrapping Redis db
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res-bootstrap-redis/configuration.toml ${BOOTSTRAP_REDIS_DIR}/res/
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res-bootstrap-redis/configuration.yaml ${BOOTSTRAP_REDIS_DIR}/res/

# needed for bootstrapping mosquitto
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res-bootstrap-mosquitto/configuration.toml ${BOOTSTRAP_MOSQUITTO_DIR}/res/
COPY --from=builder /edgex-go/cmd/security-bootstrapper/res-bootstrap-mosquitto/configuration.yaml ${BOOTSTRAP_MOSQUITTO_DIR}/res/

# copy Consul ACL related configs
COPY --from=builder /edgex-go/cmd/security-bootstrapper/consul-acl/ ${SECURITY_INIT_STAGING}/consul-bootstrapper/
Expand Down
2 changes: 1 addition & 1 deletion cmd/security-bootstrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

func main() {
// When running security-bootstrapper's subcommands, we don't want the side effect of
// the env var. EDGEX_PROFILE overriding so that unset the env can avoid the TOML's resource
// the env var. EDGEX_PROFILE overriding so that unset the env can avoid the config's resource
// directory path of the security-bootstrapper itself being modified.
_ = os.Unsetenv("EDGEX_PROFILE")

Expand Down
Loading

0 comments on commit 3efd87f

Please sign in to comment.