Code Monkey home page Code Monkey logo

Comments (5)

cpytel avatar cpytel commented on August 29, 2024

According to the Yesod book, the default session store is cookie like Rails http://www.yesodweb.com/book/sessions

I still think that there may be issues with cross-dyno access to it, but maybe we can solve it through configuration.

from carnival.

pbrisbin avatar pbrisbin commented on August 29, 2024

For reference, here's is the framework code: https://github.com/yesodweb/yesod/blob/master/yesod-core/Yesod/Core/Internal/Session.hs

And here is the library it delegates most of the work to: http://hackage.haskell.org/package/clientsession-0.9.0.3/docs/Web-ClientSession.html

I just realized that the session key is stored on the filesystem in ./config/client_session_key.aes. I believe the key is randomly generated as needed. Since we don't store this file in VCS and heroku's file systems are ephemeral, it's different on each dyno (and every restart). I'm not sure there's a way to configure the framework to read the key from an environment variable -- I may open an issue, once we confirm this is the problem, and take a swing at a PR to make it possible.

As a workaround we could commit the file for now.

from carnival.

cpytel avatar cpytel commented on August 29, 2024

Yeah, ok - Here is a thread about overriding the session backend behavior
https://groups.google.com/forum/#!searchin/yesodweb/session$20key/yesodweb/Ocbz83hiLB4/L9jo45KB_DEJ

from carnival.

pbrisbin avatar pbrisbin commented on August 29, 2024

Hmm, promising. I wonder if it's as easy as...

makeSessionBackend _ = fmap Just $ do
        let minutes = (120 * 60) -- 120 minutes
        key <- -- Something custom that reads an environment variable
        let timeout = fromIntegral (minutes * 60)
        (getCachedDate, _closeDateCacher) <- clientSessionDateCacher timeout
        return SessionBackend
            { sbLoadSession = loadClientSession key getCachedDate "_SESSION"
            }

Unfortunately, I don't think the key value is a simple string (like Rails), so using an environment variable could require a bit more.

from carnival.

pbrisbin avatar pbrisbin commented on August 29, 2024

This was done and pushed mid-week.

from carnival.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.