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.

:lock: disable cors when not in production

Kacaii 146e097c b60d062d

+17 -12
+1 -1
src/app.gleam
··· 82 82 use postgres_url <- result.try(envoy.get("DATABASE_URL")) 83 83 84 84 // Disable SSL when not in production 85 - case envoy.get("SSL_ENABLED") { 85 + case envoy.get("SIGO_PROD") { 86 86 Error(_) -> pog.url_config(name, postgres_url) 87 87 Ok(_) -> { 88 88 use config <- result.map(pog.url_config(name, postgres_url))
+16 -11
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 ··· 64 65 priv_directory <> "/log" 65 66 } 66 67 68 + ///  Disable CORS when not in production 67 69 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_header("authorization") 76 - |> cors.allow_header("content-type") 77 - |> cors.allow_header("origin") 78 - |> cors.allow_credentials() 70 + case envoy.get("SIGO_PROD") { 71 + Error(_) -> cors.new() 72 + Ok(_) -> 73 + cors.new() 74 + |> cors.allow_origin("https://sigo.cbpm.vercel.app") 75 + |> cors.allow_method(http.Get) 76 + |> cors.allow_method(http.Post) 77 + |> cors.allow_method(http.Put) 78 + |> cors.allow_method(http.Delete) 79 + |> cors.allow_header("authorization") 80 + |> cors.allow_header("content-type") 81 + |> cors.allow_header("origin") 82 + |> cors.allow_credentials() 83 + } 79 84 } 80 85 81 86 pub fn handle_decode_error(