Skip to content

Commit

Permalink
Merge pull request #72 from osspkg/refactoring_2023
Browse files Browse the repository at this point in the history
Refactoring 2023
  • Loading branch information
markus621 committed Dec 31, 2023
2 parents 033eafc + e3d127e commit 44d3ad8
Show file tree
Hide file tree
Showing 39 changed files with 827 additions and 763 deletions.
2 changes: 1 addition & 1 deletion acl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ replace (

require (
go.osspkg.com/goppy/errors v0.1.0
go.osspkg.com/goppy/xtest v0.1.2
go.osspkg.com/goppy/xtest v0.1.3
)
20 changes: 12 additions & 8 deletions app/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package app

import (
"go.osspkg.com/goppy/console"
"go.osspkg.com/goppy/iofile"
"go.osspkg.com/goppy/syscall"
"go.osspkg.com/goppy/xc"
"go.osspkg.com/goppy/xlog"
Expand All @@ -31,8 +32,8 @@ type (
pidfile string
configs Modules
modules Modules
sources Sources
packages *_dic
sources iofile.FileCodec
packages Container
logout *_log
log xlog.Logger
ctx xc.Context
Expand All @@ -46,7 +47,7 @@ func New() App {
return &_app{
modules: Modules{},
configs: Modules{},
packages: newDic(ctx),
packages: NewContainer(ctx),
ctx: ctx,
exitFunc: func(_ int) {},
}
Expand Down Expand Up @@ -104,7 +105,7 @@ func (a *_app) Run() {
},
{
Message: "Running dependencies",
Call: func() error { return a.packages.Build() },
Call: func() error { return a.packages.Start() },
},
},
func(er bool) {
Expand All @@ -118,7 +119,7 @@ func (a *_app) Run() {
[]step{
{
Message: "Stop dependencies",
Call: func() error { return a.packages.Down() },
Call: func() error { return a.packages.Stop() },
},
},
)
Expand All @@ -138,14 +139,17 @@ func (a *_app) Invoke(call interface{}) {
{
Call: func() error { return a.packages.Register(a.modules...) },
},
{
Call: func() error { return a.packages.Start() },
},
{
Call: func() error { return a.packages.Invoke(call) },
},
},
func(_ bool) {},
[]step{
{
Call: func() error { return a.packages.Down() },
Call: func() error { return a.packages.Stop() },
},
},
)
Expand All @@ -170,7 +174,7 @@ func (a *_app) prepareConfig(interactive bool) {
}
if len(a.cfile) > 0 {
// read config file
a.sources = Sources(a.cfile)
a.sources = iofile.FileCodec(a.cfile)

// init logger
config := &Config{}
Expand All @@ -191,7 +195,7 @@ func (a *_app) prepareConfig(interactive bool) {
)
// decode all configs
var configs []interface{}
configs, err = typingRefPtr(a.configs, func(i interface{}) error {
configs, err = typingReflectPtr(a.configs, func(i interface{}) error {
return a.sources.Decode(i)
})
if err != nil {
Expand Down
Loading

0 comments on commit 44d3ad8

Please sign in to comment.