mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-14 13:21:45 +00:00
.github
.vscode
docker
internal
applicant
deployer
domain
access.go
acme_accounts.go
certificate.go
common.go
domains.go
err.go
notify.go
setting.go
statistics.go
workflow.go
workflow_output.go
workflow_run_log.go
domains
notify
pkg
repository
rest
routes
statistics
utils
workflow
migrations
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
32 lines
616 B
Go
32 lines
616 B
Go
package domain
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Setting struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Content string `json:"content"`
|
|
Created time.Time `json:"created"`
|
|
Updated time.Time `json:"updated"`
|
|
}
|
|
|
|
type ChannelsConfig map[string]map[string]any
|
|
|
|
func (s *Setting) GetChannelContent(channel string) (map[string]any, error) {
|
|
conf := &ChannelsConfig{}
|
|
if err := json.Unmarshal([]byte(s.Content), conf); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
v, ok := (*conf)[channel]
|
|
if !ok {
|
|
return nil, fmt.Errorf("channel \"%s\" not found", channel)
|
|
}
|
|
|
|
return v, nil
|
|
}
|