You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2024/07/25 02:11:52 UTC

(incubator-answer) 02/02: conf.go: changed struct to camelcase

This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit e0068a70f68025b2cc4d400fcb0ea55b0744ad24
Author: EkkoKo <65...@users.noreply.github.com>
AuthorDate: Wed Jul 24 08:56:04 2024 +0300

    conf.go: changed struct to camelcase
---
 internal/base/conf/conf.go | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/internal/base/conf/conf.go b/internal/base/conf/conf.go
index 4261d74d..4593f40f 100644
--- a/internal/base/conf/conf.go
+++ b/internal/base/conf/conf.go
@@ -46,18 +46,18 @@ type AllConfig struct {
 	UI            *server.UI                    `json:"ui" mapstructure:"ui" yaml:"ui"`
 }
 
-type EnvConfigOverrides struct {
-	SWAGGER_HOST         string
-	SWAGGER_ADDRESS_PORT string
+type envConfigOverrides struct {
+	SwaggerHost         string
+	SwaggerAddressPort string
 
-	SITE_ADDR string
+	SiteAddr string
 }
 
-func loadEnvs() (envOverrides *EnvConfigOverrides) {
-	return &EnvConfigOverrides{
-		SWAGGER_HOST:         os.Getenv("SWAGGER_HOST"),
-		SWAGGER_ADDRESS_PORT: os.Getenv("SWAGGER_ADDRESS_PORT"),
-		SITE_ADDR:            os.Getenv("SITE_ADDR"),
+func loadEnvs() (envOverrides *envConfigOverrides) {
+	return &envConfigOverrides{
+		SwaggerHost:         os.Getenv("SWAGGER_HOST"),
+		SwaggerAddressPort:  os.Getenv("SWAGGER_ADDRESS_PORT"),
+		SiteAddr:            os.Getenv("SITE_ADDR"),
 	}
 }
 
@@ -85,14 +85,14 @@ func (c *AllConfig) SetDefault() {
 
 func (c *AllConfig) SetEnvironmentOverrides() {
 	envs := loadEnvs()
-	if envs.SITE_ADDR != "" {
-		c.Server.HTTP.Addr = envs.SITE_ADDR
+	if envs.SiteAddr != "" {
+		c.Server.HTTP.Addr = envs.SiteAddr
 	}
-	if envs.SWAGGER_HOST != "" {
-		c.Swaggerui.Host = envs.SWAGGER_HOST
+	if envs.SwaggerHost != "" {
+		c.Swaggerui.Host = envs.SwaggerHost
 	}
-	if envs.SWAGGER_ADDRESS_PORT != "" {
-		c.Swaggerui.Address = envs.SWAGGER_ADDRESS_PORT
+	if envs.SwaggerAddressPort != "" {
+		c.Swaggerui.Address = envs.SwaggerAddressPort
 	}
 }