github.com/naoina/kocha@v0.7.1-0.20171129072645-78c7a531f799/cmd/kocha-build/testdata/config/app.go (about)

     1  package config
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"runtime"
     7  	"time"
     8  
     9  	"github.com/naoina/kocha"
    10  	"github.com/naoina/kocha/log"
    11  )
    12  
    13  var (
    14  	AppName   = "testappname"
    15  	AppConfig = &kocha.Config{
    16  		Addr:          kocha.Getenv("KOCHA_ADDR", "127.0.0.1:9100"),
    17  		AppPath:       rootPath,
    18  		AppName:       AppName,
    19  		DefaultLayout: "app",
    20  		Template: &kocha.Template{
    21  			PathInfo: kocha.TemplatePathInfo{
    22  				Name: AppName,
    23  				Paths: []string{
    24  					filepath.Join(rootPath, "app", "view"),
    25  				},
    26  			},
    27  			FuncMap: kocha.TemplateFuncMap{},
    28  		},
    29  
    30  		// Logger settings.
    31  		Logger: &kocha.LoggerConfig{
    32  			Writer:    os.Stdout,
    33  			Formatter: &log.LTSVFormatter{},
    34  			Level:     log.INFO,
    35  		},
    36  
    37  		Middlewares: []kocha.Middleware{
    38  			&kocha.RequestLoggingMiddleware{},
    39  			&kocha.SessionMiddleware{
    40  				Name: "testappname_session",
    41  				Store: &kocha.SessionCookieStore{
    42  					// AUTO-GENERATED Random keys. DO NOT EDIT.
    43  					SecretKey:  "a1uApKUdSnugB7TbvDZ5GfkGEJOUd3qbV0dpJ5Bqmc4=",
    44  					SigningKey: "jlPLiRWBaLCUg4PJ5u/Ncg==",
    45  				},
    46  
    47  				// Expiration of session cookie, in seconds, from now.
    48  				// Persistent if -1, For not specify, set 0.
    49  				CookieExpires: time.Duration(90) * time.Hour * 24,
    50  
    51  				// Expiration of session data, in seconds, from now.
    52  				// Perssitent if -1, For not specify, set 0.
    53  				SessionExpires: time.Duration(90) * time.Hour * 24,
    54  				HttpOnly:       false,
    55  			},
    56  			&kocha.DispatchMiddleware{},
    57  		},
    58  
    59  		MaxClientBodySize: 1024 * 1024 * 10, // 10MB
    60  	}
    61  
    62  	_, configFileName, _, _ = runtime.Caller(0)
    63  	rootPath                = filepath.Dir(filepath.Join(configFileName, ".."))
    64  )