Closed nicola-spb closed 7 years ago
Is this parameter SessionSecure (in config) used in somewhere?
I`m start learning golang. I want to change sessionStore to redis and I found this code. Is it right? May be should be "return ctx.SessionStore.Get" ?
@nicola-spb That code is okay, but regarding redis session, you can just override App.SessionStore
with the redis session implementation
Is this parameter SessionSecure (in config) used in somewhere?
Yes , it is passed to gorilla.Session.Options check here https://github.com/gernest/utron/blob/1f157f3b25f8ea71b1705f0d699cd1cffde65779/app/app.go#L153
Sorry I made mistake. I wanted to say about cfg.SessionStore in config. P.S. Now I replaced method getSesionStore for using Redis session
Sorry I made mistake. I wanted to say about cfg.SessionStore in config. P.S. Now I replaced method getSesionStore for using Redis session
@nicola-spb what do you mean? Can I see your code if possible? getSesionStore
looks like a private function so replacing it from where?
I forked it for myself. I want to replace gorm to sqlx too and maybe replace html/template.
func getSesionStore(cfg *config.Config) (sessions.Store, error) {
store, err := redistore.NewRediStore(10, "tcp", ":6379", "", keyPairs(cfg.SessionKeyPair)...)
if err != nil {
panic(err)
}
store.SetMaxAge(cfg.SessionMaxAge)
return store, nil
}
I see, that looks okay to me.
Maybe you should make it more flexible. I saw some frameworks but I think they so big and I prefer your.
@nicola-spb thanks. It is already flexible. You can replace view
i.e html/template
and it is possible to replace gorm too( albeit with some effort)
There is a lot of areas for improvement. You can help by opening issues for feature request, so we can make utron more awesome.
Ok. Thank you.
@nicola-spb
Check this example app https://github.com/utronframework/upload It does not use gorm at all. You can also poke around it to implement custom view
that doesnt use the one shipped.
Honestly you don't need to modify utron source to use different ORM or template rendering logic.
Ok. I started learning golang (after java, php) and I don`t get used to interface.
I`m start learning golang. I want to change sessionStore to redis and I found this code. Is it right? May be should be "return ctx.SessionStore.Get" ?