Added default keys for testing

This commit is contained in:
Eduard Urbach 2017-11-08 10:53:27 +01:00
parent a1ab50bd19
commit 1cd7e82d67
6 changed files with 128 additions and 9 deletions

16
main.go
View File

@ -19,12 +19,6 @@ func main() {
}
func configure(app *aero.Application) *aero.Application {
// HTTPS
app.Security.Load("security/fullchain.pem", "security/privkey.pem")
// CSS
app.SetStyle(css.Bundle())
// Sessions
app.Sessions.Duration = 3600 * 24 * 30 * 6
app.Sessions.Store = nanostore.New(arn.DB.Collection("Session"))
@ -32,12 +26,18 @@ func configure(app *aero.Application) *aero.Application {
// Layout
app.Layout = layout.Render
// Pages
pages.Configure(app)
// CSS
app.SetStyle(css.Bundle())
// Security
configureHTTPS(app)
// Assets
configureAssets(app)
// Pages
pages.Configure(app)
// Rewrite
app.Rewrite(rewrite)

33
security.go Normal file
View File

@ -0,0 +1,33 @@
package main
import (
"os"
"github.com/aerogo/aero"
)
func configureHTTPS(app *aero.Application) {
fullCertPath := "security/fullchain.pem"
fullKeyPath := "security/privkey.pem"
if _, err := os.Stat(fullCertPath); os.IsNotExist(err) {
defaultCertPath := "security/default/fullchain.pem"
err := os.Link(defaultCertPath, fullCertPath)
if err != nil {
panic(err)
}
}
if _, err := os.Stat(fullKeyPath); os.IsNotExist(err) {
defaultKeyPath := "security/default/privkey.pem"
err := os.Link(defaultKeyPath, fullKeyPath)
if err != nil {
panic(err)
}
}
// HTTPS
app.Security.Load(fullCertPath, fullKeyPath)
}

3
security/.gitignore vendored
View File

@ -1,4 +1,5 @@
*
!.gitignore
!default-api-keys.json
!default
!default/*
!README.md

View File

@ -0,0 +1,34 @@
-----BEGIN CERTIFICATE-----
MIIF9zCCA9+gAwIBAgIJAKf/LujsjzTPMA0GCSqGSIb3DQEBBQUAMFoxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMRwwGgYDVQQKExNBbmltZSBOb3Rp
ZmllciBCZXRhMRgwFgYDVQQDEw9iZXRhLm5vdGlmeS5tb2UwHhcNM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