A FAIRE.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

90 lines
1.7 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### components ####### Copyright (c) 2021 mls-361 ############################################## MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package components
import (
"net/http"
"forge.chapril.org/armen/jw"
"forge.chapril.org/mls-361/jsonapi"
"forge.chapril.org/mls-361/logger"
"forge.chapril.org/armen/armen/internal/config/data"
)
// Application AFAIRE.
type Application interface {
ID() string
Name() string
Debug() int
LookupEnv(suffix string) (string, bool)
Host() string
}
// Config AFAIRE.
type Config interface {
Data() *data.Data
Logger() *data.Logger
Server() *data.Server
Storage() *data.Storage
}
// Crypto AFAIRE.
type Crypto interface {
DecryptString(text string) (string, error)
}
// Logger AFAIRE.
type Logger interface {
logger.Logger
}
// Model AFAIRE.
type Model interface {
jw.Model
}
// Router AFAIRE.
type Router interface {
Handler() http.Handler
Get(path string, handler jsonapi.Handler)
Post(path string, handler jsonapi.Handler)
}
// Server AFAIRE.
type Server interface {
Start() error
Stop()
}
// Storage AFAIRE.
type Storage interface {
jw.Storage
}
// Components AFAIRE.
type Components struct {
Application Application
Config Config
Crypto Crypto
Logger Logger
Model Model
Router Router
Server Server
Storage Storage
}
// New AFAIRE.
func New(app Application) *Components {
return &Components{
Application: app,
}
}
/*
######################################################################################################## @(°_°)@ #######
*/