mirror of
https://github.com/1f349/violet.git
synced 2024-12-22 07:24:04 +00:00
Fix certificates not loading when key file exists
This commit is contained in:
parent
dcef716d8f
commit
8ab677964d
@ -10,6 +10,7 @@ import (
|
||||
"io/fs"
|
||||
"log"
|
||||
"math/big"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@ -172,6 +173,10 @@ func (c *Certs) internalCompile(m map[string]*tls.Certificate) error {
|
||||
// try to read key file
|
||||
keyData, err := fs.ReadFile(c.kDir, keyName)
|
||||
if err != nil {
|
||||
// ignore the file if the certificate doesn't exist
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
return fmt.Errorf("failed to read key file '%s': %w", keyName, err)
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{
|
||||
return subcommands.ExitFailure
|
||||
}
|
||||
|
||||
var conf startUpConfig
|
||||
err = json.NewDecoder(openConf).Decode(&conf)
|
||||
var config startUpConfig
|
||||
err = json.NewDecoder(openConf).Decode(&config)
|
||||
if err != nil {
|
||||
log.Println("[Violet] Error: invalid config file: ", err)
|
||||
return subcommands.ExitFailure
|
||||
@ -68,7 +68,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{
|
||||
|
||||
// working directory is the parent of the config file
|
||||
wd := filepath.Dir(s.configPath)
|
||||
normalLoad(conf, wd)
|
||||
normalLoad(config, wd)
|
||||
return subcommands.ExitSuccess
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user