Archived
1
0
Fork 0

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:
Julien Riou 2021-03-25 18:00:29 +01:00
commit 17a88265c6
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
7 changed files with 200 additions and 3 deletions

View file

@ -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{}