Browse Source

En cours de développement

master
mls-361 8 months ago
parent
commit
5322aa830e
  1. 3
      Taskfile.yml
  2. 33
      cmd/main.go
  3. 2
      go.mod
  4. 5
      go.sum
  5. 2
      internal/api/api.go
  6. 11
      internal/components/components.go

3
Taskfile.yml

@ -12,6 +12,9 @@ vars:
tasks:
update:
cmds:
- go get -u forge.chapril.org/armen/jw
- go get -u forge.chapril.org/armen/memory
- go get -u forge.chapril.org/armen/model
- go get -u forge.chapril.org/mls-361/application
- go get -u forge.chapril.org/mls-361/crypto
- go get -u forge.chapril.org/mls-361/failure

33
cmd/main.go

@ -59,24 +59,28 @@ func createComponents(app components.Application) (components.Logger, components
return logger, server, nil
}
func waitEnd(server components.Server) *sync.WaitGroup {
swg := new(sync.WaitGroup)
func waitEnd(server components.Server) (*sync.WaitGroup, chan struct{}) {
endCh := make(chan struct{})
group := new(sync.WaitGroup)
swg.Add(1)
group.Add(1)
go func() { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
defer swg.Done()
defer group.Done()
defer server.Stop()
sigEnd := make(chan os.Signal, 1)
defer close(sigEnd)
sigCh := make(chan os.Signal, 1)
defer close(sigCh)
signal.Notify(sigEnd, os.Interrupt, syscall.SIGABRT, syscall.SIGQUIT, syscall.SIGTERM)
signal.Notify(sigCh, os.Interrupt, syscall.SIGABRT, syscall.SIGQUIT, syscall.SIGTERM)
<-sigEnd
select {
case <-sigCh:
case <-endCh:
}
}()
return swg
return group, endCh
}
func run() error {
@ -97,17 +101,16 @@ func run() error {
"name", app.Name(),
"version", app.Version(),
"builtAt", app.BuiltAt().Format("2006-01-02 15:04:05"),
"pid", syscall.Getpid(),
"pid", os.Getpid(),
)
swg := waitEnd(server)
group, endCh := waitEnd(server)
err = server.Start()
if err != nil {
_ = syscall.Kill(syscall.Getpid(), syscall.SIGINT) //AFINIR
}
swg.Wait()
close(endCh)
group.Wait()
logger.Info( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"END",

2
go.mod

@ -3,11 +3,13 @@ module forge.chapril.org/armen/armen
go 1.15
require (
forge.chapril.org/armen/jw v0.0.0-20210412203118-f24a805abde4
forge.chapril.org/mls-361/application v0.0.0-20210414132623-3cc12ee64b10
forge.chapril.org/mls-361/crypto v0.0.0-20210412210122-fd3f4aac66eb
forge.chapril.org/mls-361/failure v0.0.0-20210412202827-a8d100489f9d
forge.chapril.org/mls-361/jsonapi v0.0.0-20210416210938-8892d7c86b70
forge.chapril.org/mls-361/logger v0.0.0-20210412202904-dadda1a823de
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff
github.com/jinzhu/copier v0.2.9 // indirect
github.com/julienschmidt/httprouter v1.3.0
)

5
go.sum

@ -1,4 +1,6 @@
cloud.google.com/go v0.16.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
forge.chapril.org/armen/jw v0.0.0-20210412203118-f24a805abde4 h1:4QpXO+P7ZEekXR92qc31Wg42MC2QYdwWr0tSHytFe2A=
forge.chapril.org/armen/jw v0.0.0-20210412203118-f24a805abde4/go.mod h1:Yucy16A+11RDmTxRNi29F4eWGUjJwQ+tP8WxbP1xIMU=
forge.chapril.org/mls-361/application v0.0.0-20210414132623-3cc12ee64b10 h1:vUnf1qBtd1/aJY0Sod5pdtVD4rAlYqWdS6E9QfhaZIM=
forge.chapril.org/mls-361/application v0.0.0-20210414132623-3cc12ee64b10/go.mod h1:POwqatcN6c54BNVrOlsJDSpRuSwoub8iRIruASBI0jM=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79 h1:Lh+y98uVFC7btl5FdxKNtokzHD2j14R4ZIgJECao6r4=
@ -35,6 +37,9 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk
github.com/gregjones/httpcache v0.0.0-20170920190843-316c5e0ff04e/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/hashicorp/hcl v0.0.0-20170914154624-68e816d1c783/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/inconshreveable/log15 v0.0.0-20170622235902-74a0988b5f80/go.mod h1:cOaXtrgN4ScfRrD9Bre7U1thNq5RtJ8ZoP4iXVGRj6o=
github.com/jinzhu/copier v0.2.8/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro=
github.com/jinzhu/copier v0.2.9 h1:v0Wnz+GKEI63FX7cU2LI20mFFlhTNl+36cjDIuhq3QY=
github.com/jinzhu/copier v0.2.9/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=

2
internal/api/api.go

@ -14,7 +14,7 @@ import (
)
const (
_maxBodySize = 1024 * 4
//_maxBodySize = 1024 * 4
)
type api struct {

11
internal/components/components.go

@ -9,6 +9,7 @@ package components
import (
"net/http"
"forge.chapril.org/armen/jw"
"forge.chapril.org/mls-361/logger"
"forge.chapril.org/mls-361/uuid"
@ -33,6 +34,11 @@ type Logger interface {
logger.Logger
}
// Model AFAIRE.
type Model interface {
jw.Model
}
// Router AFAIRE.
type Router interface {
Handler() http.Handler
@ -40,6 +46,11 @@ type Router interface {
Post(path string, handler http.Handler)
}
// Storage AFAIRE.
type Storage interface {
jw.Storage
}
// Server AFAIRE.
type Server interface {
Start() error

Loading…
Cancel
Save