Refactored services, rest and rdbms

Added tests

Added ac to routes and functions

Proxy processer and auth servicer

Added options and extensive logging

Fixed calls to rbac in service, added default http handler on gateway root
This commit is contained in:
Peter Grlica
2021-08-11 17:25:10 +02:00
parent 9fe52398a9
commit da9100287c
64 changed files with 3959 additions and 1951 deletions
+47
View File
@@ -0,0 +1,47 @@
package options
// This file is auto-generated.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// Definitions file that controls how this file is generated:
// pkg/options/apigw.yaml
import (
"time"
)
type (
ApigwOpt struct {
Enabled bool `env:"APIGW_ENABLED"`
LogEnabled bool `env:"APIGW_LOG_ENABLED"`
ProxyEnableDebugLog bool `env:"APIGW_PROXY_ENABLE_DEBUG_LOG"`
ProxyFollowRedirects bool `env:"APIGW_PROXY_FOLLOW_REDIRECTS"`
ProxyOutboundTimeout time.Duration `env:"APIGW_PROXY_OUTBOUND_TIMEOUT"`
}
)
// Apigw initializes and returns a ApigwOpt with default values
func Apigw() (o *ApigwOpt) {
o = &ApigwOpt{
Enabled: true,
LogEnabled: false,
ProxyEnableDebugLog: false,
ProxyFollowRedirects: true,
ProxyOutboundTimeout: time.Second * 30,
}
fill(o)
// Function that allows access to custom logic inside the parent function.
// The custom logic in the other file should be like:
// func (o *Apigw) Defaults() {...}
func(o interface{}) {
if def, ok := o.(interface{ Defaults() }); ok {
def.Defaults()
}
}(o)
return
}
+37
View File
@@ -0,0 +1,37 @@
docs:
title: API Gateway
imports:
- time
props:
- name: Enabled
type: bool
default: true
description: |-
Enable API Gateway
- name: logEnabled
type: bool
default: false
description: |-
Enable extra logging
- name: proxyEnableDebugLog
type: bool
default: false
description: |-
Enable full debug log on requests / responses - warning, includes sensitive data
- name: proxyFollowRedirects
type: bool
default: true
description: |-
Follow redirects on proxy requests
- name: proxyOutboundTimeout
type: time.Duration
default: time.Second * 30
description: |-
Outbound request timeout