You've already forked VptPassiveAdapter
- 在StorageConfig中新增AliOSS字段以配置阿里云OSS参数 - 新增AliOSSConfig结构体定义阿里云OSS相关配置项 - 在fs包中实现AliOSSAdapter适配器用于操作阿里云OSS - 实现GetFileList方法从阿里云OSS获取并缓存文件列表 - 添加定时清理过期缓存的功能 - 更新adapter.go根据存储类型选择对应的适配器实例
62 lines
1.8 KiB
Go
62 lines
1.8 KiB
Go
package config
|
|
|
|
type ApiConfig struct {
|
|
BaseUrl string `mapstructure:"baseUrl"`
|
|
}
|
|
|
|
type RecordConfig struct {
|
|
Storage StorageConfig `mapstructure:"storage"`
|
|
Duration int `mapstructure:"duration"`
|
|
}
|
|
|
|
type StorageConfig struct {
|
|
Type string `mapstructure:"type"`
|
|
Path string `mapstructure:"path"`
|
|
S3 S3Config `mapstructure:"s3"`
|
|
AliOSS AliOSSConfig `mapstructure:"aliOss"`
|
|
}
|
|
|
|
type S3Config struct {
|
|
Region string `mapstructure:"region"`
|
|
Endpoint string `mapstructure:"endpoint"`
|
|
Bucket string `mapstructure:"bucket"`
|
|
Prefix string `mapstructure:"prefix"`
|
|
AkId string `mapstructure:"akId"`
|
|
AkSec string `mapstructure:"akSec"`
|
|
}
|
|
|
|
type AliOSSConfig struct {
|
|
Endpoint string `mapstructure:"endpoint"`
|
|
Bucket string `mapstructure:"bucket"`
|
|
Prefix string `mapstructure:"prefix"`
|
|
AccessKeyId string `mapstructure:"accessKeyId"`
|
|
AccessKeySecret string `mapstructure:"accessKeySecret"`
|
|
}
|
|
|
|
type DeviceMapping struct {
|
|
DeviceNo string `mapstructure:"deviceNo" json:"deviceNo"`
|
|
Name string `mapstructure:"name" json:"name"`
|
|
}
|
|
|
|
type FileNameConfig struct {
|
|
DateSeparator string `mapstructure:"dateSeparator"`
|
|
TimeSplit string `mapstructure:"timeSplit"`
|
|
FileExt string `mapstructure:"fileExt"`
|
|
UnfinishedFileExt string `mapstructure:"unFinExt"`
|
|
}
|
|
|
|
type ViidConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
ServerUrl string `mapstructure:"serverUrl"`
|
|
ScenicId int64 `mapstructure:"scenicId"`
|
|
Port int `mapstructure:"port"`
|
|
}
|
|
|
|
type MainConfig struct {
|
|
Api ApiConfig `mapstructure:"api"`
|
|
Record RecordConfig `mapstructure:"record"`
|
|
Devices []DeviceMapping `mapstructure:"devices"`
|
|
FileName FileNameConfig `mapstructure:"fileName"`
|
|
Viid ViidConfig `mapstructure:"viid"`
|
|
}
|