mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00
v0.5: removed system service env, log output format fix
This commit is contained in:
parent
85fb637551
commit
23e7d06081
4 changed files with 10 additions and 18 deletions
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var IsRunningAsService = getEnvBool("GOPROXY_IS_SYSTEMD")
|
||||
var NoSchemaValidation = getEnvBool("GOPROXY_NO_SCHEMA_VALIDATION")
|
||||
var IsDebug = getEnvBool("GOPROXY_DEBUG")
|
||||
|
||||
|
|
19
src/main.go
19
src/main.go
|
@ -32,19 +32,12 @@ func main() {
|
|||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
|
||||
if common.IsRunningAsService {
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
DisableColors: true,
|
||||
DisableTimestamp: true,
|
||||
DisableSorting: true,
|
||||
})
|
||||
} else {
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
DisableSorting: true,
|
||||
FullTimestamp: true,
|
||||
TimestampFormat: "01-02 15:04:05",
|
||||
})
|
||||
}
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
DisableSorting: true,
|
||||
FullTimestamp: true,
|
||||
ForceColors: true,
|
||||
TimestampFormat: "01-02 15:04:05",
|
||||
})
|
||||
|
||||
if args.Command == common.CommandReload {
|
||||
if err := apiUtils.ReloadServer(); err.IsNotNil() {
|
||||
|
|
|
@ -155,7 +155,7 @@ func (p *Provider) loadRoutes() E.NestedError {
|
|||
e.Alias = a
|
||||
r, err := R.NewRoute(e)
|
||||
if err.IsNotNil() {
|
||||
errors.Addf("%s: %w", a, err)
|
||||
errors.Add(err.Subject(a))
|
||||
p.l.Debugf("failed to load route: %s, %s", a, err)
|
||||
} else {
|
||||
p.routes.Set(a, r)
|
||||
|
|
|
@ -67,7 +67,7 @@ func NewHTTPRoute(entry *P.Entry) (*HTTPRoute, E.NestedError) {
|
|||
path := entry.Path.String()
|
||||
if _, exists := r.Subroutes[path]; exists {
|
||||
httpRoutes.Unlock()
|
||||
return nil, E.Duplicated("path", path).Subject(entry.Alias)
|
||||
return nil, E.Duplicated("path", path)
|
||||
}
|
||||
r.mux.HandleFunc(path, rp.ServeHTTP)
|
||||
if err := recover(); err != nil {
|
||||
|
@ -75,9 +75,9 @@ func NewHTTPRoute(entry *P.Entry) (*HTTPRoute, E.NestedError) {
|
|||
switch t := err.(type) {
|
||||
case error:
|
||||
// NOTE: likely path pattern error
|
||||
return nil, E.From(t).Subject(entry.Alias)
|
||||
return nil, E.From(t)
|
||||
default:
|
||||
return nil, E.From(fmt.Errorf("%v", t)).Subject(entry.Alias)
|
||||
return nil, E.From(fmt.Errorf("%v", t))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue