Spaces:
Paused
Paused
Update bin/config/config.go
Browse files- bin/config/config.go +6 -24
bin/config/config.go
CHANGED
|
@@ -1,47 +1,29 @@
|
|
| 1 |
package config
|
| 2 |
|
| 3 |
import (
|
| 4 |
-
"github.com/joho/godotenv"
|
| 5 |
"log"
|
| 6 |
"os"
|
| 7 |
-
"strconv"
|
| 8 |
"strings"
|
| 9 |
)
|
| 10 |
|
| 11 |
type Env struct {
|
| 12 |
-
RootApp
|
| 13 |
-
HTTPPort
|
| 14 |
-
BaseURL
|
| 15 |
}
|
| 16 |
|
| 17 |
var GlobalEnv Env
|
| 18 |
|
| 19 |
func init() {
|
| 20 |
-
err := godotenv.Load()
|
| 21 |
-
|
| 22 |
-
if err != nil {
|
| 23 |
-
log.Println(err)
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
var ok bool
|
| 27 |
-
|
| 28 |
path, err := os.Getwd()
|
| 29 |
if err != nil {
|
| 30 |
log.Println(err)
|
| 31 |
}
|
| 32 |
-
|
| 33 |
rootApp := strings.TrimSuffix(path, "/bin/config")
|
| 34 |
os.Setenv("APP_PATH", rootApp)
|
| 35 |
GlobalEnv.RootApp = rootApp
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
GlobalEnv.HTTPPort = uint16(port)
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
GlobalEnv.BaseURL, ok = os.LookupEnv("BASE_URL")
|
| 44 |
-
if !ok {
|
| 45 |
-
panic("missing BASE_URL environment")
|
| 46 |
-
}
|
| 47 |
}
|
|
|
|
| 1 |
package config
|
| 2 |
|
| 3 |
import (
|
|
|
|
| 4 |
"log"
|
| 5 |
"os"
|
|
|
|
| 6 |
"strings"
|
| 7 |
)
|
| 8 |
|
| 9 |
type Env struct {
|
| 10 |
+
RootApp string
|
| 11 |
+
HTTPPort uint16
|
| 12 |
+
BaseURL string
|
| 13 |
}
|
| 14 |
|
| 15 |
var GlobalEnv Env
|
| 16 |
|
| 17 |
func init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
path, err := os.Getwd()
|
| 19 |
if err != nil {
|
| 20 |
log.Println(err)
|
| 21 |
}
|
|
|
|
| 22 |
rootApp := strings.TrimSuffix(path, "/bin/config")
|
| 23 |
os.Setenv("APP_PATH", rootApp)
|
| 24 |
GlobalEnv.RootApp = rootApp
|
| 25 |
|
| 26 |
+
// KITA PAKSA NILAINYA DI SINI AGAR TIDAK ERROR
|
| 27 |
+
GlobalEnv.HTTPPort = 7860
|
| 28 |
+
GlobalEnv.BaseURL = "https://komiku.id/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|