DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

cf5c4139915e0078cec4ed7c875cdaf48d300991 — Jonni Liljamo 1 year, 7 months ago c4de093
feat(api): increase session lifetime to 30 days
1 files changed, 14 insertions(+), 2 deletions(-)

M api/src/main.rs
M api/src/main.rs => api/src/main.rs +14 -2
@@ 6,9 6,16 @@
 * See LICENSE for licensing information.
 */

use actix_session::{storage::RedisActorSessionStore, Session, SessionMiddleware};
use actix_session::{
    config::{PersistentSession, SessionLifecycle, TtlExtensionPolicy},
    storage::RedisActorSessionStore,
    Session, SessionMiddleware,
};
use actix_web::{
    cookie::Key, get, middleware::Logger, web, App, HttpResponse, HttpServer, Responder,
    cookie::{time::Duration, Key},
    get,
    middleware::Logger,
    web, App, HttpResponse, HttpServer, Responder,
};

use diesel::{


@@ 82,6 89,11 @@ async fn main() -> std::io::Result<()> {
                    RedisActorSessionStore::new(&redis_url),
                    Key::from(cookie_key.as_bytes()),
                )
                .session_lifecycle(SessionLifecycle::PersistentSession(
                    PersistentSession::default()
                        .session_ttl(Duration::days(30))
                        .session_ttl_extension_policy(TtlExtensionPolicy::OnStateChanges),
                ))
                .build(),
            )
            .service(ping)