Documentation ¶
Index ¶
- Variables
- func CreateAgones() (siface.IAgones, error)
- func CreateMock() (siface.IAgones, error)
- func NewAllocateClient(sSetting AllocateSettingsParams) (allocation.AllocationServiceClient, error)
- func NewAllocateClientMock(url string) (allocation.AllocationServiceClient, error)
- type AllocateParams
- type AllocateResult
- type AllocateSettingsParams
- type AllocateSettingsResult
- type SDKParams
- type SDKResult
Constants ¶
This section is empty.
Variables ¶
View Source
var AgonesSDKModule = fx.Provide( func( l *zap.Logger, appSetting mfx.AppParams, ) (out SDKResult, err error) { if deploy := utility.ParseDeployments(appSetting.Deployment); deploy.IsProd() { a, err := CreateAgones() if err != nil { return out, err } out.SDK = a } else { a, err := CreateMock() if err != nil { return out, err } out.SDK = a } return }, )
AgonesSDKModule is a fx module that provides an Agones sdk(deployment==prod)/mock Agones sdk(deployment!=prod)
View Source
var AllocateClientModule = fx.Provide( func( params mfx.AppParams, sSetting AllocateSettingsParams, ) (out AllocateResult, err error) { if utility.ParseDeployments(params.Deployment).IsProd() { if cli, e := NewAllocateClient(sSetting); e != nil { err = e } else { out.AllocateClient = cli } } else { if cli, e := NewAllocateClientMock(sSetting.MockAllocateUrl); err != nil { err = e } else { out.AllocateClient = cli } } return }, )
AllocateClientModule is a fx module that provides an AllocateClient
View Source
var AllocateSettingsModule = fx.Provide( func() (out AllocateSettingsResult, err error) { err = out.LoadFromEnv() return }, )
Functions ¶
func CreateAgones ¶
CreateAgones deploy local agones sdk server
func CreateMock ¶
CreateMock create an empty agones sdk,it will not do anything This is used for local/debugging
func NewAllocateClient ¶
func NewAllocateClient(sSetting AllocateSettingsParams) (allocation.AllocationServiceClient, error)
NewAllocateClient creates a new AllocateClient, requires a host and security settings. Agones need security settings(mTls) to connect to the allocator server. https://agones.dev/site/docs/advanced/allocator-service/#client-certificate
func NewAllocateClientMock ¶
func NewAllocateClientMock(url string) (allocation.AllocationServiceClient, error)
Types ¶
type AllocateParams ¶
type AllocateParams struct { fx.In AllocateClient allocation.AllocationServiceClient `name:"AllocateClient"` }
type AllocateResult ¶
type AllocateResult struct { fx.Out AllocateClient allocation.AllocationServiceClient `name:"AllocateClient"` }
type AllocateSettingsParams ¶
type AllocateSettingsResult ¶
type AllocateSettingsResult struct { fx.Out AllocateServiceUrl string `name:"AllocateServiceUrl" envconfig:"ALLOCATE_SERVICE_URL" default:""` ClientCert string `name:"AllocateClientCert" envconfig:"ALLOCATE_CLIENT_CERT" default:"./configs/x509/agones/tls.crt"` ClientKey string `name:"AllocateClientKey" envconfig:"ALLOCATE_CLIENT_KEY" default:"./configs/x509/agones/tls.key"` ServerCaCert string `name:"AllocateServerCaCert" envconfig:"ALLOCATE_SERVER_CA_CERT" default:"./configs/x509/agones/ca.crt"` MockAllocateUrl string `name:"MockAllocateUrl" envconfig:"MOCK_ALLOCATE_URL" default:"localhost:8888"` }
func (*AllocateSettingsResult) LoadFromEnv ¶
func (g *AllocateSettingsResult) LoadFromEnv() (err error)
Click to show internal directories.
Click to hide internal directories.