-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into feat/cd-pipeline-with-github-actions
- Loading branch information
Showing
8 changed files
with
192 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
package fiberfx | ||
|
||
import ( | ||
"github.com/kelseyhightower/envconfig" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
type Config struct { | ||
Port int `envconfig:"PORT" default:"8080"` | ||
CORSAllowOrigins string `envconfig:"CORS_ALLOW_ORIGINS" default:"*"` | ||
CORSAllowMethods string `envconfig:"CORS_ALLOW_METHODS" default:"GET,POST,HEAD,PUT,DELETE,PATCH"` | ||
CORSAllowHeaders string `envconfig:"CORS_ALLOW_HEADERS" default:""` | ||
CORSAllowHeaders string `envconfig:"CORS_ALLOW_HEADERS" default:"*"` | ||
CORSAllowCredentials bool `envconfig:"CORS_ALLOW_CREDENTIALS" default:"false"` | ||
} | ||
|
||
func parseConfig() *Config { | ||
return &Config{ | ||
Port: 8080, | ||
CORSAllowOrigins: "*", | ||
CORSAllowMethods: "GET,POST,HEAD,PUT,DELETE,PATCH", | ||
CORSAllowHeaders: "*", | ||
CORSAllowCredentials: false, | ||
func parseConfig() (*Config, error) { | ||
var config Config | ||
|
||
if err := envconfig.Process("", &config); err != nil { | ||
return nil, errors.New("failed to parse config from environment variables") | ||
} | ||
|
||
return &config, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
package gormfx | ||
|
||
import ( | ||
"github.com/kelseyhightower/envconfig" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
type Config struct { | ||
DBDriver string `envconfig:"DB_DRIVER" default:""` | ||
DBUser string `envconfig:"DB_USER" default:""` | ||
DBPassword string `envconfig:"DB_PASSWORD" default:""` | ||
DBHost string `envconfig:"DB_HOST" default:""` | ||
DBName string `envconfig:"DB_NAME" default:""` | ||
DBPort string `envconfig:"DB_PORT" default:""` | ||
ConnMaxLifetimeSeconds int64 `envconfig:"DB_CONN_MAX_LIFETIME_SECONDS" default:"0"` | ||
MaxIdleConns int `envconfig:"DB_MAX_IDLE_CONNS" default:"0"` | ||
MaxOpenConns int `envconfig:"DB_MAX_OPEN_CONNS" default:"0"` | ||
DBDriver string `envconfig:"DB_DRIVER" default:"mysql"` | ||
DBUser string `envconfig:"DB_USER" default:"root"` | ||
DBPassword string `envconfig:"DB_PASSWORD" default:"password"` | ||
DBHost string `envconfig:"DB_HOST" default:"localhost"` | ||
DBName string `envconfig:"DB_NAME" default:"dittodining"` | ||
DBPort string `envconfig:"DB_PORT" default:"3306"` | ||
ConnMaxLifetimeSeconds int64 `envconfig:"DB_CONN_MAX_LIFETIME_SECONDS" default:"1800"` | ||
MaxIdleConns int `envconfig:"DB_MAX_IDLE_CONNS" default:"10"` // TODO: DB 스펙에 따라 적절치로 조정 | ||
MaxOpenConns int `envconfig:"DB_MAX_OPEN_CONNS" default:"10"` | ||
} | ||
|
||
func parseConfig() *Config { | ||
return &Config{ | ||
DBDriver: "mysql", | ||
DBUser: "root", | ||
DBPassword: "password", | ||
DBHost: "localhost", | ||
DBName: "dittodining", | ||
DBPort: "3306", | ||
ConnMaxLifetimeSeconds: 1800, | ||
MaxIdleConns: 10, // TODO: DB 스펙에 따라 적절치로 조정 | ||
MaxOpenConns: 10, | ||
func parseConfig() (*Config, error) { | ||
var config Config | ||
if err := envconfig.Process("", &config); err != nil { | ||
return nil, errors.New("failed to parse config from environment variables") | ||
} | ||
|
||
return &config, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters