Documentation
¶
Index ¶
- func ConnectPostgres(s DatabaseSettings) (*gorm.DB, error)
- func LoadRSAPrivateKey(path string) (*rsa.PrivateKey, error)
- func LoadRSAPublicKey(path string) (*rsa.PublicKey, error)
- func SetupEcho() (*echo.Echo, error)
- type AuthSettings
- type Base
- type DatabaseSettings
- type HTTPSettings
- type JWTClaims
- type ObjectStoreSettings
- type SSLMode
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectPostgres ¶
func ConnectPostgres(s DatabaseSettings) (*gorm.DB, error)
ConnectPostgres connects to a Postgres database using the given settings and returns a *gorm.DB handle.
func LoadRSAPrivateKey ¶
func LoadRSAPrivateKey(path string) (*rsa.PrivateKey, error)
LoadRSAPrivateKey reads an RSA private key from the specified file
func LoadRSAPublicKey ¶
LoadRSAPublicKey reads an RSA public key from the specified file
Types ¶
type AuthSettings ¶
AuthSettings configures application authentication.
type Base ¶
type Base struct {
Settings Settings
AuthPublicKey *rsa.PublicKey
AuthPrivateKey *rsa.PrivateKey
DB *gorm.DB
ObjectStore *minio.Client
Echo *echo.Echo
}
Base contains a core set of dependencies needed for web services. This struct can be made available to HTTP handlers.
func New ¶
New environment using settings provided via command line options and environment variables. You can also implement your own version of this if you need to since Env fields are all public.
func (*Base) JWTMiddleware ¶
func (base *Base) JWTMiddleware() echo.MiddlewareFunc
JWTMiddleware returns JWT authentication middleware
type DatabaseSettings ¶
type DatabaseSettings struct {
Host string
Port int
User string
Password string
Name string
SSLMode string
SSLRootCert string
SSLCert string
SSLKey string
}
DatabaseSettings specifies location and authentication information needed to connect to the application database.
type HTTPSettings ¶
type HTTPSettings struct {
ListenAddress string
}
HTTPSettings configures the application HTTP interface.
type JWTClaims ¶
type JWTClaims struct {
Name string `json:"name,omitempty"`
Admin bool `json:"admin,omitempty"`
Context string `json:"context,omitempty"`
jwt.StandardClaims
}
JWTClaims are custom claims extending default ones
type ObjectStoreSettings ¶
ObjectStoreSettings configures the application object storage endpoint.
type Settings ¶
type Settings struct {
Database DatabaseSettings
ObjectStore ObjectStoreSettings
Auth AuthSettings
HTTP HTTPSettings
}
Settings for the application
func GetSettings ¶
func GetSettings() Settings
GetSettings returns application configuration derived from command line options and environment variables.