Browse Source

En cours de développement

master
losyme 10 months ago
parent
commit
89a1e8b77d
  1. 1
      Taskfile.yml
  2. 1
      go.mod
  3. 2
      go.sum
  4. 30
      internal/application/application.go
  5. 25
      internal/application/cmdline.go
  6. 4
      internal/application/config.go
  7. 0
      internal/application/scheduler.go
  8. 15
      internal/application/storage.go
  9. 6
      internal/components/components.go

1
Taskfile.yml

@ -12,6 +12,7 @@ vars:
tasks:
update:
cmds:
- go get -u forge.chapril.org/dune/jw
- go get -u forge.chapril.org/losyme/application
- go get -u forge.chapril.org/losyme/cmdline
- go get -u forge.chapril.org/losyme/config

1
go.mod

@ -3,6 +3,7 @@ module forge.chapril.org/dune/dune
go 1.17
require (
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d
forge.chapril.org/losyme/application v0.0.0-20211008200819-b014e639a171
forge.chapril.org/losyme/cmdline v0.0.0-20211010173716-509a4c1f872e
forge.chapril.org/losyme/config v0.0.0-20211005163519-b38ce8696276

2
go.sum

@ -1,3 +1,5 @@
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d h1:WIUQkPby58OE0m+NsnULN0o8wuqHpZpWEhMR6FXIxX8=
forge.chapril.org/dune/jw v0.0.0-20211011190008-0d0af336164d/go.mod h1:4bBiRiEBc73tjk/Osfh+lmpoWR1p8p4xIkHdo8aLjdg=
forge.chapril.org/eckmuhl/context v0.0.0-20211010163718-0742c5d7087c h1:X5LoqoVwBRU7nUliXNVS/yXcgoR9AUSsgCvJvTk08Ak=
forge.chapril.org/eckmuhl/context v0.0.0-20211010163718-0742c5d7087c/go.mod h1:mLBQDTayRooyfmrjPQWbIFobAIclOW3ERaikGuQLiUA=
forge.chapril.org/eckmuhl/router v0.0.0-20211010164023-a12c003438f7 h1:eVBWbgEpLqGjrGYlSniExbLt2AnEbk5Ab8nWQXmAxIw=

30
internal/application/application.go

@ -13,10 +13,6 @@ import (
"forge.chapril.org/dune/dune/internal/components"
)
type clFlags struct {
demo bool
}
type Application struct {
minikit *minikit.Kit
components *components.Components
@ -57,17 +53,29 @@ func New(name, version, builtAt string, args []string) *Application {
}
func (app *Application) run() error {
defer func() {
if logger := app.components.Logger; logger != nil {
logger.Close()
}
}()
if err := app.minikit.Build(); err != nil {
return err
}
if err := app.storage(); err != nil {
return err
}
return app.minikit.Build()
return nil
}
func (app *Application) Run() error {
return app.components.Application.OnError(app.run()) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
err := app.run()
if logger := app.components.Logger; logger != nil {
if err != nil {
logger.Fatal(err.Error()) //////////////////////////////////////////////////////////////////////////////////
}
logger.Close()
}
return app.components.Application.OnError(err) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
}
/*

25
internal/application/cmdline.go

@ -8,9 +8,28 @@ package application
import "forge.chapril.org/losyme/cmdline"
type clFlags struct {
strValue string
demo bool
}
func (app *Application) cmdlineInitialize() []*cmdline.Cmd {
clf := app.clFlags
cmdDecrypt := &cmdline.Cmd{
Name: "decrypt",
Usage: "decrypt string",
}
cmdDecrypt.StringFlag(&clf.strValue, "string", "", "string to decrypt")
cmdEncrypt := &cmdline.Cmd{
Name: "encrypt",
Usage: "encrypt string",
}
cmdEncrypt.StringFlag(&clf.strValue, "string", "", "string to encrypt")
cmdSetup := &cmdline.Cmd{
Name: "setup",
Usage: "application setup",
@ -18,7 +37,11 @@ func (app *Application) cmdlineInitialize() []*cmdline.Cmd {
cmdSetup.BoolFlag(&clf.demo, "demo", false, "demonstration mode")
return []*cmdline.Cmd{cmdSetup}
return []*cmdline.Cmd{
cmdDecrypt,
cmdEncrypt,
cmdSetup,
}
}
/*

4
internal/application/config.go

@ -12,10 +12,12 @@ func (app *Application) configInitialize(cfg *config.Config) {
cfg.Set("trace", "logger", "level")
cfg.Set([]string{"stderr"}, "logger", "outputs")
cfg.Set(65530, "server", "port")
cfg.Set(5635, "server", "port")
cfg.Set("1m", "server", "idletimeout")
cfg.Set("5s", "server", "readtimeout")
cfg.Set("10s", "server", "writetimeout")
cfg.Set("memory", "storage")
}
/*

0
internal/application/events.go → internal/application/scheduler.go

15
internal/application/storage.go

@ -0,0 +1,15 @@
/*
------------------------------------------------------------------------------------------------------------------------
####### dune ####### Copyright (c) 2021 losyme ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package application
func (app *Application) storage() error {
return nil
}
/*
######################################################################################################## @(°_°)@ #######
*/

6
internal/components/components.go

@ -6,10 +6,14 @@
package components
import "forge.chapril.org/losyme/minikit/pkg/components"
import (
"forge.chapril.org/dune/jw"
"forge.chapril.org/losyme/minikit/pkg/components"
)
type Components struct {
*components.Components
Storage jw.Storage
}
/*

Loading…
Cancel
Save