En cours de développement

master
losyme 7 months ago
parent 9d341c8e0e
commit 2916e90b52
  1. 4
      go.mod
  2. 7
      go.sum
  3. 10
      internal/application/application.go
  4. 41
      internal/swagger/swagger.go
  5. 7
      systemd/dune.service

@ -9,13 +9,13 @@ require (
forge.chapril.org/losyme/cmdline v0.0.0-20220304233859-a80f0236f813
forge.chapril.org/losyme/config v0.0.0-20220303163050-9e8a82fc5323
forge.chapril.org/losyme/errors v0.0.0-20220303163019-96d7d430ce60
forge.chapril.org/losyme/kong v0.0.0-20220303163111-3c17475660ba
forge.chapril.org/losyme/kong v0.0.0-20220310220508-5afadc6fe093
forge.chapril.org/losyme/logger v0.0.0-20220310104805-0c59362a0e54
forge.chapril.org/losyme/scheduler v0.0.0-20220310105803-bcb9d896ac38
forge.chapril.org/losyme/util v0.0.0-20220303162913-a08a5d5a454b
forge.chapril.org/losyme/uuid v0.0.0-20220303162916-380896aa99a2
forge.chapril.org/minikit/daemon v0.0.0-20220310105014-e4045ba8427a
forge.chapril.org/minikit/kong v0.0.0-20220310105029-bafbf4842200
forge.chapril.org/minikit/kong v0.0.0-20220310220548-3d9228a2c76d
forge.chapril.org/minikit/minikit v0.0.0-20220310104951-8b4c4ebc2226
forge.chapril.org/minikit/scheduler v0.0.0-20220310110000-7124edd25d01
)

@ -18,8 +18,9 @@ forge.chapril.org/losyme/daemon v0.0.0-20220309142746-4f6b4f4865e4/go.mod h1:Yxx
forge.chapril.org/losyme/errors v0.0.0-20220303163019-96d7d430ce60 h1:Uo/p2PhfdRFg4n24wuIpgdW8sgVA+xmCwBoYJwd89ls=
forge.chapril.org/losyme/errors v0.0.0-20220303163019-96d7d430ce60/go.mod h1:Sch2u1KD8UQrBZQSv4Cws10yvM78ucshG/Rt6JhbG9I=
forge.chapril.org/losyme/king v0.0.0-20220303163102-369a3a9e24ec/go.mod h1:7LMMf2aHDxAi/CA2QD2TSyteqUGT2t1DO+8gxHhSv2Y=
forge.chapril.org/losyme/kong v0.0.0-20220303163111-3c17475660ba h1:+CfAV9lfCSgENpdqhXnSQekpfmJD72zcBHisw3gB8UY=
forge.chapril.org/losyme/kong v0.0.0-20220303163111-3c17475660ba/go.mod h1:Wng5EMF7hCgh1T1sK8VE3aKvm6eGXZfffM+dnGiepWw=
forge.chapril.org/losyme/kong v0.0.0-20220310220508-5afadc6fe093 h1:avTW5mf0aV7Y9vbScuSGrM+qJ8sqEwioDrBq4dIME80=
forge.chapril.org/losyme/kong v0.0.0-20220310220508-5afadc6fe093/go.mod h1:Wng5EMF7hCgh1T1sK8VE3aKvm6eGXZfffM+dnGiepWw=
forge.chapril.org/losyme/kvfmt v0.0.0-20220303163006-b730060b1c5e h1:8BTtgXaJp80BUWZtusc0YQ61vzn7M4ovybCimzrB1dI=
forge.chapril.org/losyme/kvfmt v0.0.0-20220303163006-b730060b1c5e/go.mod h1:h4nD31BawEXtTSfZI8yazBBAGewzByVTcfV/SL84ETU=
forge.chapril.org/losyme/logger v0.0.0-20220310104805-0c59362a0e54 h1:hU757j7pVW/+gc5PklcspbkzmqFg2t0e1D4zD+/6OWY=
@ -35,8 +36,8 @@ forge.chapril.org/losyme/zombie v0.0.0-20220303162918-29fc9b2d4c2c h1:S6JsNFVfWr
forge.chapril.org/losyme/zombie v0.0.0-20220303162918-29fc9b2d4c2c/go.mod h1:f2dCQZ+o+tk8hzWDapLPvqjiEF1QShkS19jOptvoYaM=
forge.chapril.org/minikit/daemon v0.0.0-20220310105014-e4045ba8427a h1:RiKEhYIF1ZR/2rH0u5bFGuW9ebN1nA1z+h+SOidTPDM=
forge.chapril.org/minikit/daemon v0.0.0-20220310105014-e4045ba8427a/go.mod h1:IK4qrdbCwXDC3VjpL73XbvGpsgfwl986kiCNSIn94us=
forge.chapril.org/minikit/kong v0.0.0-20220310105029-bafbf4842200 h1:HiYJD6f0spv48fXhPZbsbd9pkkzrNTGkkYKcF7NlL9I=
forge.chapril.org/minikit/kong v0.0.0-20220310105029-bafbf4842200/go.mod h1:PNI0G/4lVXXkxZK2bEnNG7P5smmG7G1bG7x9Cz4unCY=
forge.chapril.org/minikit/kong v0.0.0-20220310220548-3d9228a2c76d h1:P3cKgIE0L3FRVSQTnRrP31HTfN1IG3yVK6fFOIhCj6s=
forge.chapril.org/minikit/kong v0.0.0-20220310220548-3d9228a2c76d/go.mod h1:3t4qM877sF2ngYxjmqn+6Nmyg7tq0sA97af7NEGsLVw=
forge.chapril.org/minikit/minikit v0.0.0-20220310104951-8b4c4ebc2226 h1:feGZEO7sOzwWLja74MW0oOVW4ki8OzfpJp602nkXhVg=
forge.chapril.org/minikit/minikit v0.0.0-20220310104951-8b4c4ebc2226/go.mod h1:I00+PS/CvwzxWyZJb0dtPolqZR3YKARpzuMmVnSLR3w=
forge.chapril.org/minikit/scheduler v0.0.0-20220310110000-7124edd25d01 h1:wpKe6UPzfVG8kpXXefG0Uc2w/38pA5jluPXZfiJFvh4=

@ -21,6 +21,7 @@ import (
"forge.chapril.org/dune/dune/internal/api"
"forge.chapril.org/dune/dune/internal/components"
"forge.chapril.org/dune/dune/internal/model"
"forge.chapril.org/dune/dune/internal/swagger"
)
type Application struct {
@ -42,6 +43,11 @@ func (app *Application) api() error {
return err
}
func (app *Application) swagger() error {
_, err := swagger.New(app.cs)
return err
}
func (app *Application) model() error {
cs := app.cs
@ -78,6 +84,10 @@ func (app *Application) Run() error {
"api",
minikit.WithBuild(app.api),
),
minikit.NewComponent(
"swagger",
minikit.WithBuild(app.swagger),
),
server.New(cs),
daemon.New(cs, nil), // @FIXME
scheduler.New(cs, app.onMessage),

@ -0,0 +1,41 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### dune ####### Copyright (c) 2021-2022 losyme ################################################ MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package swagger
import (
"forge.chapril.org/losyme/kong/context"
"forge.chapril.org/dune/dune/internal/components"
)
type Swagger struct {
cs *components.Components
}
func New(cs *components.Components) (*Swagger, error) {
sr, err := cs.Router().NewSubRouter("/swagger", "")
if err != nil {
return nil, err
}
swagger := &Swagger{
cs: cs,
}
sr.Get("/swagger", swagger.ui)
return swagger, nil
}
func (s *Swagger) ui(c *context.Context) error {
c.RenderStatusNoContent()
return nil
}
/*
######################################################################################################## @(°_°)@ #######
*/

@ -17,11 +17,8 @@ User=dune
Group=dune
Environment="DUNE_KEY=***"
ExecStart=/usr/local/bin/dune
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=dune
SyslogFacility=local4
SyslogLevel=notice
StandardOutput=kmsg
StandardError=inherit
[Install]
WantedBy=multi-user.target

Loading…
Cancel
Save