Skip to content

Commit

Permalink
refactor(dev): set-session is a dev feature so move it to app-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
justmoon committed Sep 22, 2024
1 parent a367a5a commit 01b2653
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 0 additions & 3 deletions packages/app-dassie/src/authentication/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createActor } from "@dassie/lib-reactive"

import type { DassieActorContext } from "../base/types/dassie-base"
import { HasNodeIdentitySignal } from "../config/computed/has-node-identity"
import { RegisterDevelopmentSetSessionRouteActor } from "./http-routes/development-set-session"
import { RegisterLoginRouteActor } from "./http-routes/login"
import { RegisterLogoutRouteActor } from "./http-routes/logout"
import { RegisterSetupRouteActor } from "./http-routes/setup"
Expand All @@ -12,8 +11,6 @@ export const AuthenticationFeatureActor = () =>
if (sig.readAndTrack(HasNodeIdentitySignal)) {
sig.run(RegisterLoginRouteActor)
sig.run(RegisterLogoutRouteActor)

if (import.meta.env.DEV) sig.run(RegisterDevelopmentSetSessionRouteActor)
} else {
sig.run(RegisterSetupRouteActor)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { z } from "zod"

import { COOKIE_MAX_AGE_SECONDS } from "@dassie/app-dassie/src/authentication/constants/cookie-lifetime"
import type { SessionToken } from "@dassie/app-dassie/src/authentication/types/session-token"
import { SESSION_COOKIE_NAME } from "@dassie/app-dassie/src/constants/cookie-name"
import { HttpsRouter } from "@dassie/app-dassie/src/http-server/values/https-router"
import {
createJsonResponse,
parseBodyZod,
setCookie,
} from "@dassie/lib-http-server"
import { createActor } from "@dassie/lib-reactive"

import { SESSION_COOKIE_NAME } from "../../constants/cookie-name"
import { HttpsRouter } from "../../http-server/values/https-router"
import { COOKIE_MAX_AGE_SECONDS } from "../constants/cookie-lifetime"
import type { SessionToken } from "../types/session-token"

export const RegisterDevelopmentSetSessionRouteActor = () =>
createActor((sig) => {
if (!import.meta.env.DEV) return

const http = sig.reactor.use(HttpsRouter)

http
Expand Down
2 changes: 2 additions & 0 deletions packages/app-dev/src/runner/launchers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createActor, createReactor } from "@dassie/lib-reactive"
import { createRuntime } from "@dassie/lib-reactive-io/node"

import { HandleShutdownSignalsActor } from "../../actors/handle-shutdown-signals"
import { RegisterDevelopmentSetSessionRouteActor } from "../actors/development-set-session"
import { ForwardLogsActor } from "../actors/forward-logs"
import { ForwardPeerTrafficActor } from "../actors/forward-peer-traffic"
import { HandleDisconnectActor } from "../actors/handle-disconnect"
Expand Down Expand Up @@ -35,6 +36,7 @@ const DebugRunnerActor = () =>

await dassieContext.run(DaemonActor)
await dassieContext.run(ServeHttpsActor)
sig.run(RegisterDevelopmentSetSessionRouteActor)
})

const reactor = createReactor()
Expand Down

0 comments on commit 01b2653

Please sign in to comment.