tricrypt/env/env.go

31 lines
467 B
Go
Raw Normal View History

2024-02-23 14:28:59 +01:00
package env
2024-02-23 18:02:43 +01:00
import (
"os"
"strconv"
"git.qowevisa.me/Qowevisa/gotell/errors"
)
2024-02-23 14:28:59 +01:00
const (
Port = 2993
2024-02-23 17:48:25 +01:00
ConnectPort = 443
2024-02-23 14:28:59 +01:00
)
2024-02-23 18:02:43 +01:00
func GetHost() (string, error) {
host := os.Getenv("GOTELL_HOST")
if host == "" {
return host, errors.ENV_EMPTY
}
return host, nil
}
func GetPort() (int, error) {
portStr := os.Getenv("GOTELL_PORT")
if portStr == "" {
return 0, errors.ENV_EMPTY
}
port, err := strconv.ParseInt(portStr, 10, 32)
return int(port), err
}