Household planning and management software meant to organise and streamline neurodivergent households.
0

Configure Feed

Select the types of activity you want to include in your feed.

Move app name from env vars to db

MLC Bloeiman (Jan 14, 2026, 11:15 PM +0100) bb3f8afd 01cf29c7

+15 -12
+7 -6
sweetnhouse_server/src/sweetnhouse_server.gleam
··· 1 1 import dot_env/env 2 2 import gleam/erlang/process 3 - import gleam/int 4 3 import gleam/io 5 4 import gleam/result 6 5 import mist ··· 48 47 } 49 48 #(key, True) -> key 50 49 } 50 + 51 51 wisp.configure_logger() 52 52 53 53 case ··· 55 55 |> mist.new 56 56 |> mist.port(ctx.port) 57 57 |> mist.bind("0.0.0.0") 58 - |> mist.after_start(fn(_, _, _) { Nil }) 58 + // |> mist.after_start(fn(_, _, _) { Nil }) 59 59 |> mist.start 60 60 { 61 - Ok(_server) -> 62 - io.println("🚀 Server started on port " <> int.to_string(ctx.port)) 61 + Ok(_server) -> { 62 + // io.println("🚀 Server started on port " <> int.to_string(ctx.port)) 63 + Nil 64 + } 63 65 Error(_error) -> io.println_error("Failed to start server!") 64 66 } 65 67 ··· 70 72 } 71 73 72 74 fn get_context() -> Result(web.Context, String) { 73 - let app_name = env.get_string_or("APP_NAME", "SweetNHouse") 74 75 let port = env.get_int_or("PORT", 3005) 75 76 76 77 let pool_name = process.new_name("sweetnhouse_db_pool") ··· 102 103 Ok(web.Context( 103 104 static_directory: static_directory, 104 105 db_pool_name: pool_name, 105 - app_name: app_name, 106 + app_name: "SweetnHouse", 106 107 port: port, 107 108 )) 108 109 }
+6 -4
sweetnhouse_server/src/sweetnhouse_server/router.gleam
··· 1 1 import gleam/http.{Get} 2 2 import gleam/list 3 + import gleam/pair 3 4 import gleam/string 5 + import sweetnhouse_server/config 4 6 import sweetnhouse_server/web.{type Context} 5 7 import wisp.{type Request, type Response} 6 8 ··· 27 29 True -> "nl-NL" 28 30 False -> "en-GB" 29 31 } 30 - wisp.ok() 31 - |> wisp.html_body(" 32 - <!doctype html> 32 + let app_name = 33 + config.get_or(ctx, "app_name", fn() { "SweetnHouse" }) |> pair.first 34 + wisp.html_body(wisp.ok(), "<!doctype html> 33 35 <html lang=\"" <> langtag <> "\"> 34 36 <head> 35 37 <meta charset=\"UTF-8\" /> 36 38 <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /> 37 39 38 - <title>" <> ctx.app_name <> "</title> 40 + <title>" <> app_name <> "</title> 39 41 40 42 <link rel=\"stylesheet\" href=\"/static/client.css\" /> 41 43 <script type=\"module\" src=\"/static/client.mjs\"></script>
+2 -2
sweetnhouse_server/src/sweetnhouse_server/web.gleam
··· 1 - import pog 2 1 import gleam/erlang/process 2 + import pog 3 3 import wisp 4 4 5 5 /// Context 6 6 pub type Context { 7 7 Context( 8 8 static_directory: String, 9 - db_pool_name: process.Name(pog.Message), 9 + db_pool_name: process.Name(pog.Message), 10 10 app_name: String, 11 11 port: Int, 12 12 )