wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

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

:recycle: pass the user ip as env var

Kacaii 65b2848f 8f606237

+18 -12
+18 -12
src/app/web.gleam
··· 17 17 18 18 import app/web/context 19 19 import cors_builder as cors 20 + import envoy 20 21 import gleam/dynamic/decode 21 22 import gleam/http 22 23 import gleam/json ··· 65 66 } 66 67 67 68 fn cors_config() -> cors.Cors { 68 - cors.new() 69 - |> cors.allow_origin("http://localhost:5173") 70 - |> cors.allow_origin("https://sigo.cbpm.vercel.app") 71 - |> cors.allow_method(http.Get) 72 - |> cors.allow_method(http.Post) 73 - |> cors.allow_method(http.Put) 74 - |> cors.allow_method(http.Delete) 75 - |> cors.allow_method(http.Options) 76 - |> cors.allow_header("authorization") 77 - |> cors.allow_header("content-type") 78 - |> cors.allow_header("origin") 79 - |> cors.allow_credentials() 69 + let config = 70 + cors.new() 71 + |> cors.allow_origin("https://sigo.cbpm.vercel.app") 72 + |> cors.allow_method(http.Get) 73 + |> cors.allow_method(http.Post) 74 + |> cors.allow_method(http.Put) 75 + |> cors.allow_method(http.Delete) 76 + |> cors.allow_method(http.Options) 77 + |> cors.allow_header("authorization") 78 + |> cors.allow_header("content-type") 79 + |> cors.allow_header("origin") 80 + |> cors.allow_credentials() 81 + 82 + case envoy.get("SIGO_HOST") { 83 + Ok(host) -> cors.allow_origin(config, host) 84 + Error(_) -> config 85 + } 80 86 } 81 87 82 88 pub fn handle_decode_error(