Add HTTP API
Add `-api` mode to start the HTTP API with the following routes: - /health - /shops - /shops/:id - /products - /products/:id Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
3122e59325
commit
17a88265c6
7 changed files with 200 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
type Config struct {
|
||||
TwitterConfig `json:"twitter"`
|
||||
TelegramConfig `json:"telegram"`
|
||||
ApiConfig `json:"api"`
|
||||
URLs []string `json:"urls"`
|
||||
IncludeRegex string `json:"include_regex"`
|
||||
ExcludeRegex string `json:"exclude_regex"`
|
||||
|
|
@ -32,6 +33,13 @@ type TelegramConfig struct {
|
|||
ChannelName string `json:"channel_name"`
|
||||
}
|
||||
|
||||
// ApiConfig to store HTTP API configuration
|
||||
type ApiConfig struct {
|
||||
Address string `json:"address"`
|
||||
Certfile string `json:"cert_file"`
|
||||
Keyfile string `json:"key_file"`
|
||||
}
|
||||
|
||||
// NewConfig creates a Config struct
|
||||
func NewConfig() *Config {
|
||||
return &Config{}
|
||||
|
|
|
|||
Reference in a new issue