build: implement services image build and CI release. (#2920)

* build: implement services image build.

* remove unused tools

* update test.

* update images.

* update dockerfile and go mod.

* update go mod.

* Add comments.

* update go pkg.

* update loadConfig and discovery logic in kubernetes.

* update go pkg and discovery field.

* update Load method args.
This commit is contained in:
Monet Lee
2024-12-07 17:35:42 +08:00
committed by GitHub
parent 59fb9886e5
commit 24ab940875
43 changed files with 1024 additions and 702 deletions
+18 -2
View File
@@ -1,13 +1,29 @@
package config
import (
"os"
"path/filepath"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/openimsdk/tools/errs"
"github.com/spf13/viper"
"strings"
)
func LoadConfig(path string, envPrefix string, config any) error {
func Load(configDirectory string, configFileName string, envPrefix string, runtimeEnv string, config any) error {
if runtimeEnv == KUBERNETES {
mountPath := os.Getenv(MountConfigFilePath)
if mountPath == "" {
return errs.ErrArgs.WrapMsg(MountConfigFilePath + " env is empty")
}
return loadConfig(filepath.Join(mountPath, configFileName), envPrefix, config)
}
return loadConfig(filepath.Join(configDirectory, configFileName), envPrefix, config)
}
func loadConfig(path string, envPrefix string, config any) error {
v := viper.New()
v.SetConfigFile(path)
v.SetEnvPrefix(envPrefix)