Add Iroquois/Powow API mocking entrypoint
This commit is contained in:
@ -11,8 +11,9 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
HTTP HTTPConfig `yaml:"http"`
|
||||
Data DataConfig `yaml:"data"`
|
||||
HTTP HTTPConfig `yaml:"http"`
|
||||
Data DataConfig `yaml:"data"`
|
||||
Powow PowowConfig `ymal:"powow"`
|
||||
}
|
||||
|
||||
type HTTPConfig struct {
|
||||
@ -25,6 +26,18 @@ type DataConfig struct {
|
||||
Path string `yaml:"path" env:"FAKESMS_DATA_PATH"`
|
||||
}
|
||||
|
||||
type PowowConfig struct {
|
||||
APIKey string `yaml:"apiKey" env:"FAKESMS_POWOW_API_KEY"`
|
||||
SMS []PowowSMS `yaml:"sms"`
|
||||
}
|
||||
|
||||
type PowowSMS struct {
|
||||
Name string `yaml:"name"`
|
||||
From string `yaml:"from"`
|
||||
Content string `yaml:"content"`
|
||||
ShortLink bool `yaml:"shortLink"`
|
||||
}
|
||||
|
||||
// NewFromFile retrieves the configuration from the given file
|
||||
func NewFromFile(filepath string) (*Config, error) {
|
||||
config := NewDefault()
|
||||
@ -57,13 +70,27 @@ func NewDumpDefault() *Config {
|
||||
func NewDefault() *Config {
|
||||
return &Config{
|
||||
HTTP: HTTPConfig{
|
||||
Address: ":8080",
|
||||
Address: ":3000",
|
||||
TemplateDir: "template",
|
||||
PublicDir: "public",
|
||||
},
|
||||
Data: DataConfig{
|
||||
Path: "fakesms.db",
|
||||
},
|
||||
Powow: PowowConfig{
|
||||
APIKey: "powow",
|
||||
SMS: []PowowSMS{
|
||||
{
|
||||
Name: "Powow SMS",
|
||||
From: "FakeSMS",
|
||||
ShortLink: false,
|
||||
Content: `Bonjour %Subscriber:Firstname%,
|
||||
|
||||
Lorem ipsum dolor sit amet...
|
||||
`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user