transfer_middleware/until/env.go

41 lines
659 B
Go
Raw Normal View History

2024-07-16 18:26:51 +08:00
package until
2024-07-16 18:39:48 +08:00
2024-07-16 18:54:13 +08:00
import (
"fmt"
"os"
)
2024-07-16 18:39:48 +08:00
func GetConfig() string {
2024-07-16 18:54:13 +08:00
var dir string
pwd, _ := os.Getwd()
path := fmt.Sprintf("%s%s", pwd, "/../../env")
bytes, _ := os.ReadFile(path)
2024-10-15 18:35:45 +08:00
env := string(bytes)
switch env {
case "produce\n":
2024-07-16 18:54:13 +08:00
dir = "produce.yaml"
2024-10-15 18:35:45 +08:00
case "test\n":
dir = "test.yaml"
default:
dir = "local.yaml"
}
return dir
}
func GetConfigQueue() string {
var dir string
pwd, _ := os.Getwd()
path := fmt.Sprintf("%s%s", pwd, "/../../../env")
bytes, _ := os.ReadFile(path)
env := string(bytes)
switch env {
case "produce\n":
dir = "produce.yaml"
case "test\n":
2024-07-16 18:54:13 +08:00
dir = "test.yaml"
default:
dir = "local.yaml"
}
return dir
2024-07-16 18:39:48 +08:00
}