Documentation ¶
Overview ¶
Copyright © 2022 Sloan Childers
Index ¶
- Variables
- func GetDSN(cfg *Config) string
- func InitLogger(level string)
- func ListenAndServe(cfg *Config, router *chi.Mux)
- func LoadEnv(output interface{})
- func LoadJson(fileName string, cfg interface{}) error
- func OpenDB(cfg *Config) *gorm.DB
- func Param(r *http.Request, key string) string
- func PrintEnvironment()
- func SendError(w http.ResponseWriter, err error, status int)
- func SendPrettyJSON(ctx context.Context, w http.ResponseWriter, data interface{})
- func Start()
- type Config
- type ShutdownHandler
- type VideoRecorder
- func (x *VideoRecorder) CameraStartHandler(w http.ResponseWriter, r *http.Request)
- func (x *VideoRecorder) CameraStopHandler(w http.ResponseWriter, r *http.Request)
- func (x *VideoRecorder) CameraStreamHandler(w http.ResponseWriter, r *http.Request)
- func (x *VideoRecorder) ShutdownHandler(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCameraNotFound = errors.New("camera not found")
Functions ¶
func InitLogger ¶
func InitLogger(level string)
TODO: all this boilerplate stuff needs it's own repo
func ListenAndServe ¶
func ListenAndServe(cfg *Config, router *chi.Mux)
func PrintEnvironment ¶
func PrintEnvironment()
func SendPrettyJSON ¶
func SendPrettyJSON(ctx context.Context, w http.ResponseWriter, data interface{})
Types ¶
type Config ¶
type Config struct { FilesystemPath string `env:"LOCAL_DB_PATH" envDefault:"./external/"` PathPrefix string `env:"PATH_PREFIX" envDefault:"/"` ListenAddr string `env:"LISTEN_ADDR,required" envDefault:"127.0.0.1:8080"` LogLevel string `env:"LOG_LEVEL" envDefault:"TRACE"` PgDB string `env:"POSTGRES_DB" envDefault:"postgres"` PgHost string `env:"POSTGRES_HOST" envDefault:"127.0.0.1"` PgHostAuth string `env:"POSTGRES_HOST_AUTH_METHOD" envDefault:"trust"` PgPassword string `env:"POSTGRES_PASSWORD" envDefault:"postgres"` PgPort string `env:"POSTGRES_PORT" envDefault:"5432"` PgUser string `env:"POSTGRES_USER" envDefault:"postgres"` SSLCertFile string `env:"CERT_FILE"` SSLKeyFile string `env:"KEY_FILE"` }
type ShutdownHandler ¶
type ShutdownHandler struct {
// contains filtered or unexported fields
}
func NewShutdownHandler ¶
func NewShutdownHandler() *ShutdownHandler
func (*ShutdownHandler) AddListener ¶
func (x *ShutdownHandler) AddListener(f func())
func (*ShutdownHandler) Listen ¶
func (x *ShutdownHandler) Listen()
type VideoRecorder ¶
type VideoRecorder struct { }
func NewVideoServer ¶
func NewVideoServer() *VideoRecorder
func (*VideoRecorder) CameraStartHandler ¶
func (x *VideoRecorder) CameraStartHandler(w http.ResponseWriter, r *http.Request)
func (*VideoRecorder) CameraStopHandler ¶
func (x *VideoRecorder) CameraStopHandler(w http.ResponseWriter, r *http.Request)
func (*VideoRecorder) CameraStreamHandler ¶
func (x *VideoRecorder) CameraStreamHandler(w http.ResponseWriter, r *http.Request)
func (*VideoRecorder) ShutdownHandler ¶
func (x *VideoRecorder) ShutdownHandler(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.