mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-19 03:26:57 +00:00
Handle certificate errors with mock certificates (fixes #10)
This commit is contained in:
parent
5b6e3748b4
commit
f29ebc57d3
2 changed files with 200 additions and 82 deletions
19
main.go
19
main.go
|
@ -74,6 +74,25 @@ var IndexPages = []string{
|
|||
|
||||
// main sets up and starts the web server.
|
||||
func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "--remove-certificate" {
|
||||
if len(os.Args) < 2 {
|
||||
println("--remove-certificate requires at least one domain as an argument")
|
||||
os.Exit(1)
|
||||
}
|
||||
if keyDatabaseErr != nil {
|
||||
panic(keyDatabaseErr)
|
||||
}
|
||||
for _, domain := range os.Args[2:] {
|
||||
if err := keyDatabase.Delete([]byte(domain)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
if err := keyDatabase.Sync(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Make sure MainDomain has a trailing dot, and GiteaRoot has no trailing slash
|
||||
if !bytes.HasPrefix(MainDomainSuffix, []byte{'.'}) {
|
||||
MainDomainSuffix = append([]byte{'.'}, MainDomainSuffix...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue