feat: config small fix
This commit is contained in:
parent
60b40c84f3
commit
4877f72f04
|
@ -13,10 +13,10 @@ type Config struct {
|
||||||
ScriptBinaryPath string `required:"true" split_words:"true"`
|
ScriptBinaryPath string `required:"true" split_words:"true"`
|
||||||
WebhookScriptPath string `required:"true" split_words:"true"`
|
WebhookScriptPath string `required:"true" split_words:"true"`
|
||||||
FileToWatchPath string `required:"true" split_words:"true"`
|
FileToWatchPath string `required:"true" split_words:"true"`
|
||||||
TestFileToWatchPath string `required:"true" split_words:"true"`
|
TestFileToWatchPath string `required:"false" split_words:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func rootDir() string {
|
func RootDir() string {
|
||||||
cmdOut, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
|
cmdOut, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("exec.Command: %s", err)
|
log.Fatalf("exec.Command: %s", err)
|
||||||
|
@ -29,7 +29,7 @@ func rootDir() string {
|
||||||
|
|
||||||
func NewConfig(isProd bool) *Config {
|
func NewConfig(isProd bool) *Config {
|
||||||
if !isProd {
|
if !isProd {
|
||||||
err := godotenv.Load(rootDir() + "/.env")
|
err := godotenv.Load(RootDir() + "/.env")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n")
|
log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue