Files
golib/config/components/aws/interface.go
Nicolas JUHEL 39948566e3 Package Logger :
- Fix too many open file for logger file
- Fix invalid FD for log file
- Fix bug with field into entry
- Fix race detection on testing

Package Status :
- Add capability to send short into query to received a short output without any result of component
- Add Connection Header as Close to router status return of Get
- Fix race detection into health with concurrent read/write data
- Fix race detection with update of main router

Package HTTPServer :
- Add option to disable keepalive for server
- Fix config tag error
- Fix logger usage / close

Package Config :
- Fix component using logger to implement a close
- Fix logger initialization :
  - use local var to setup new logger based on logger clone if loger still existing
  - if error while configuring new logger, do not change logger
  - closing old logger before replace it with new

Package Router :
- Fix missing ignore error return
- Fix golib logger not closed

Other :
- Bump dependencies
2022-11-07 17:47:29 +01:00

80 lines
2.0 KiB
Go

/*
* MIT License
*
* Copyright (c) 2022 Nicolas JUHEL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
package aws
import (
"net/http"
"sync"
libaws "github.com/nabbar/golib/aws"
libcfg "github.com/nabbar/golib/config"
liberr "github.com/nabbar/golib/errors"
)
const (
ComponentType = "aws"
)
type ComponentAws interface {
libcfg.Component
RegisterHTTPClient(fct func() *http.Client)
GetAws() (libaws.AWS, liberr.Error)
SetAws(a libaws.AWS)
}
func New(drv ConfigDriver) ComponentAws {
return &componentAws{
ctx: nil,
get: nil,
fsa: nil,
fsb: nil,
fra: nil,
frb: nil,
m: sync.Mutex{},
d: drv,
a: nil,
}
}
func Register(cfg libcfg.Config, key string, cpt ComponentAws) {
cfg.ComponentSet(key, cpt)
}
func RegisterNew(cfg libcfg.Config, drv ConfigDriver, key string) {
cfg.ComponentSet(key, New(drv))
}
func Load(getCpt libcfg.FuncComponentGet, key string) ComponentAws {
if c := getCpt(key); c == nil {
return nil
} else if h, ok := c.(ComponentAws); !ok {
return nil
} else {
return h
}
}