mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Work in bernhardreiter's PR#4.
This commit is contained in:
parent
70eb8875a4
commit
f2d8cd1e90
2 changed files with 7 additions and 7 deletions
|
|
@ -14,7 +14,7 @@ const (
|
||||||
defaultConfigPath = "/usr/lib/casf/config.toml"
|
defaultConfigPath = "/usr/lib/casf/config.toml"
|
||||||
defaultFolder = "/var/www/"
|
defaultFolder = "/var/www/"
|
||||||
defaultWeb = "/var/www/html"
|
defaultWeb = "/var/www/html"
|
||||||
defaultPGPURL = "http://pgp.mit.edu/pks/lookup?search=${KEY}&op=index"
|
defaultOpenPGPURL = "https://openpgp.circl.lu/pks/lookup?search=${KEY}&op=index"
|
||||||
)
|
)
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
|
|
@ -23,7 +23,7 @@ type config struct {
|
||||||
Web string `toml:"web"`
|
Web string `toml:"web"`
|
||||||
TLPs []tlp `toml:"tlps"`
|
TLPs []tlp `toml:"tlps"`
|
||||||
UploadSignature bool `toml:"upload_signature"`
|
UploadSignature bool `toml:"upload_signature"`
|
||||||
PGPURL string `toml:"pgp_url"`
|
OpenPGPURL string `toml:"openpgp_url"`
|
||||||
Domain string `toml:"domain"`
|
Domain string `toml:"domain"`
|
||||||
NoPassphrase bool `toml:"no_passphrase"`
|
NoPassphrase bool `toml:"no_passphrase"`
|
||||||
Publisher *csaf.Publisher `toml:"publisher"`
|
Publisher *csaf.Publisher `toml:"publisher"`
|
||||||
|
|
@ -56,8 +56,8 @@ func (t *tlp) UnmarshalText(text []byte) error {
|
||||||
return fmt.Errorf("invalid config TLP value: %v", string(text))
|
return fmt.Errorf("invalid config TLP value: %v", string(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *config) GetPGPURL(key string) string {
|
func (cfg *config) GetOpenPGPURL(key string) string {
|
||||||
return strings.ReplaceAll(cfg.PGPURL, "${KEY}", key)
|
return strings.ReplaceAll(cfg.OpenPGPURL, "${KEY}", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *config) modelTLPs() []csaf.TLPLabel {
|
func (cfg *config) modelTLPs() []csaf.TLPLabel {
|
||||||
|
|
@ -98,8 +98,8 @@ func loadConfig() (*config, error) {
|
||||||
cfg.TLPs = []tlp{tlpCSAF, tlpWhite, tlpGreen, tlpAmber, tlpRed}
|
cfg.TLPs = []tlp{tlpCSAF, tlpWhite, tlpGreen, tlpAmber, tlpRed}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.PGPURL == "" {
|
if cfg.OpenPGPURL == "" {
|
||||||
cfg.PGPURL = defaultPGPURL
|
cfg.OpenPGPURL = defaultOpenPGPURL
|
||||||
}
|
}
|
||||||
|
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ func (c *controller) upload(rw http.ResponseWriter, r *http.Request) {
|
||||||
// TODO: Check for conflicts.
|
// TODO: Check for conflicts.
|
||||||
pmd.Publisher = ex.publisher
|
pmd.Publisher = ex.publisher
|
||||||
|
|
||||||
pmd.SetPGP(fingerprint, c.cfg.GetPGPURL(fingerprint))
|
pmd.SetPGP(fingerprint, c.cfg.GetOpenPGPURL(fingerprint))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue