art: Refactor out config sections

Now there is a `install` section in the config that has the fields that previously where in `c3os` but
were actually only used during install phase.

Also the k3s and c3os config were moved to the provider instead that in the global config.
This commit is contained in:
Ettore Di Giacinto
2022-07-16 20:47:55 +00:00
committed by Itxaka
parent fc21b17f0c
commit adce182ea2
13 changed files with 126 additions and 67 deletions

View File

@@ -5,12 +5,14 @@ import (
"io/ioutil"
"os"
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
. "github.com/c3os-io/c3os/internal/provider"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/c3os-io/c3os/pkg/config"
"github.com/mudler/go-pluggable"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"
)
var _ = Describe("Challenge provider", func() {
@@ -26,12 +28,15 @@ var _ = Describe("Challenge provider", func() {
Expect(err).ToNot(HaveOccurred())
defer os.RemoveAll(f.Name())
cfg := &config.Config{
C3OS: &config.C3OS{
cfg := &providerConfig.Config{
C3OS: &providerConfig.C3OS{
NetworkToken: "foo",
},
}
c := &bus.EventPayload{Config: cfg.String()}
d, err := yaml.Marshal(cfg)
Expect(err).ToNot(HaveOccurred())
c := &bus.EventPayload{Config: string(d)}
dat, err := json.Marshal(c)
Expect(err).ToNot(HaveOccurred())
@@ -46,12 +51,14 @@ var _ = Describe("Challenge provider", func() {
Expect(err).ToNot(HaveOccurred())
defer os.RemoveAll(f.Name())
cfg := &config.Config{
C3OS: &config.C3OS{
cfg := &providerConfig.Config{
C3OS: &providerConfig.C3OS{
NetworkToken: "",
},
}
c := &bus.EventPayload{Config: cfg.String()}
d, err := yaml.Marshal(cfg)
Expect(err).ToNot(HaveOccurred())
c := &bus.EventPayload{Config: string(d)}
dat, err := json.Marshal(c)
Expect(err).ToNot(HaveOccurred())