code: func GetCookieSecret() string {
  	session := db.GetSession()
  	defer session.Close()
  
  	config := globalconfig.NewManager()
  	globalconfig.InitModels()
  
  	cookie, err := config.GetByKey("cookieSecret")
  	if err != nil {
  		log.Debug("No cookie secret found, generating a new one")
  
  		secret, err := generateCookieSecret(32)
  
  		if err != nil {
  			log.Panic("Cannot generate secret cookie")
  		}
  
  		cookie.Key = "cookieSecret"
  		cookie.Value = secret
  
  		err = config.Insert(cookie)
  
  		// Key was inserted by another instance in the meantime
  		if db.IsDup(err) {
  			cookie, err = config.GetByKey("cookieSecret")
  
  			if err != nil {
  				log.Panic("Cannot retreive cookie secret")
  			}
  		}
  	}
  
  	log.Debug("Cookie secret: ", cookie.Value)
  
  	return cookie.Value
  }
docs: // GetCookieSecret gets the cookie secret from mongodb if it exists otherwise, generate a new one and save it