-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
created Options interface #33
Conversation
Could you split the |
52a6467
to
5a96c03
Compare
I removed the last two commits. Much better. FYI, I used this gist successfully. I had first tried |
I'll create a new issue to discuss I'm dropping the request for |
This pull request is old. How about I withdraw this request until v2 comes out and can re-examine? Or leave it here for historical purposes? As is the case with many gophers, Since this original pull-request, I've come to define session options within a configuration file and feed them into "sessionOptions": {
"domain": "example.com",
"httpOnly": true,
"idleTimeoutMinutes": 0,
"lifetimeMinutes": 1440,
"name": "session",
"path": "/",
"persist": false,
"secure": false,
"autoSave": true
} |
V2 obsoletes this request. 👍 |
Options
interface exposes the privateoptions
struct without breaking code, so this is backwards-compatible. Onlygetters
are available on the interface.set
functions could be added later, if desired. The interface is available through themanager.Opts()
function. Added a single test function that compares against defaults.Opts()
allows web frameworks (eg echo) to create middleware that will play nicely with scs. See issues The problem of log.Println() in Use() function #24 and problems with using wrapping Use for echo.There are two additional commits associated with this pull request. This was actually unintended b/c I began the pull request before the 2nd two commits were added but Github automatically added them to this request. I can try splitting out, if you want.
All three commits are backwards-compatible with the defaults.
Re.
saved
property to session: helps the backend data store determine stale records. Also required byTouchWithInterval()
to know ifTouch()
should occur. In order to preserve strict backwards compatibility, I added amanager.UseSaved()
function. If theopts.useSaved
value is true, only then will the date be saved in the sessions store.Re.
TouchWithInterval
: limits amount of unnecessary writes to back end data store. This would close #32.I have an an echo middleware example but will wait to commit and have that conversation after we can get past these. Thanks!