mail based rss feed aggregator
2
fork

Configure Feed

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

add port env to configuration

ollie ed905671 d672c032

+31 -4
+3
README.md
··· 122 122 - `SMTP_SENDER_NAME` 123 123 the 'name' of the sender to use 124 124 125 + - `PORT` 126 + the 'port' to use for the web-ui, defaults to 3000 127 + 125 128 - `ALLOW_SIGNUPS` 126 129 whether new users need to first be added by an admin (false) or can simply log in (true) 127 130 defaults to `false`
+26 -2
src/eater/configuration.gleam
··· 1 1 import eater/user 2 2 import envoy 3 + import gleam/int 3 4 import gleam/result 4 5 import woof 5 6 6 7 pub type AppConfig { 7 - AppConfig(allow_signups: Bool, default_admin_password_hash: BitArray) 8 + AppConfig( 9 + allow_signups: Bool, 10 + default_admin_password_hash: BitArray, 11 + port: Int, 12 + ) 8 13 } 9 14 10 15 pub fn from_environment(logger: woof.Logger) -> Result(AppConfig, String) { 11 - woof.log(logger, woof.Info, "Getting ALLOW_SIGNUPS", []) 16 + woof.log(logger, woof.Info, "Getting ADMIN_PASSWORD", []) 12 17 13 18 use password <- result.try( 14 19 envoy.get("ADMIN_PASSWORD") 15 20 |> result.replace_error("ADMIN_PASSWORD is missing"), 16 21 ) 17 22 23 + woof.log(logger, woof.Info, "Getting ALLOW_SIGNUPS", []) 18 24 let allow_signups = case envoy.get("ALLOW_SIGNUPS") { 19 25 Ok("false") | Ok("False") | Ok("FALSE") -> False 20 26 Ok(_) -> True 21 27 _ -> False 22 28 } 23 29 30 + woof.log(logger, woof.Info, "Getting PORT", []) 31 + let port = case 32 + envoy.get("PORT") 33 + |> result.try(int.parse) 34 + { 35 + Ok(port) -> port 36 + _ -> { 37 + woof.log( 38 + logger, 39 + woof.Warning, 40 + "PORT is either missing or not an integer, defaulting to 3000", 41 + [], 42 + ) 43 + 3000 44 + } 45 + } 46 + 24 47 AppConfig( 25 48 allow_signups:, 26 49 default_admin_password_hash: user.hash_password(password), 50 + port:, 27 51 ) 28 52 |> Ok 29 53 }
+2 -2
src/eater/webserver.gleam
··· 49 49 } 50 50 51 51 ewe.new(request_handler) 52 - |> ewe.bind("localhost") 53 - |> ewe.listening(1234) 52 + |> ewe.bind("0.0.0.0") 53 + |> ewe.listening(configuration.port) 54 54 |> ewe.supervised() 55 55 } 56 56