feat(init): First commit

This commit is contained in:
Thomas Maurice 2024-02-11 19:59:34 +01:00
commit f92368748a
Signed by: thomas
GPG key ID: 1D577F50583032A6
22 changed files with 1298 additions and 0 deletions

View file

@ -0,0 +1,8 @@
package configs
type OVHConfig struct {
Endpoint string `yaml:"endpoint"`
ApplicationKey string `yaml:"application_key"`
ApplicationSecret string `yaml:"application_secret"`
ConsumerKey string `yaml:"consumer_key"`
}

35
pkg/providers/ovh/ovh.go Normal file
View file

@ -0,0 +1,35 @@
package ovh
import (
"fmt"
"git.maurice.fr/thomas/mailout/pkg/config"
ovhgo "github.com/ovh/go-ovh/ovh"
)
type OVHProvider struct {
Client *ovhgo.Client
}
func NewOVHProvider(cfg *config.Config) (*OVHProvider, error) {
config := cfg.Providers.OVH
if config == nil {
return nil, fmt.Errorf("no ovh configuration specified")
}
c, err := ovhgo.NewClient(
config.Endpoint,
config.ApplicationKey,
config.ApplicationSecret,
config.ConsumerKey,
)
if err != nil {
return nil, err
}
return &OVHProvider{
Client: c,
}, nil
}

View file

@ -0,0 +1 @@
package provider