Skip to content

Commit

Permalink
Configure for Cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Nov 4, 2024
1 parent f4b3293 commit d90a3f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v1.6.0 - 2024-11-04

- The Cloudflare Tunnel `"cf-connecting-ip"` header is now used to get the
client IP address.

## v1.5.0 - 2024-11-04

- "Enter" keypresses no longer submit the form, to avoid accidental submissions.
Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "survey"
version = "1.5.0"
version = "1.6.0"
licences = ["Apache-2.0"]

# Fill out these fields if you intend to generate HTML documentation or publish
Expand Down
2 changes: 1 addition & 1 deletion src/survey/router.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn handle_form_submission(req: Request) -> Response {
|> storail.key(id)
|> storail.write([
#("id", id),
#("ip", request.get_header(req, "x-forwarded-for") |> result.unwrap("")),
#("ip", request.get_header(req, "cf-connecting-ip") |> result.unwrap("")),
#("inserted-at", datetime.now_utc() |> datetime.to_string),
..answers
])
Expand Down

0 comments on commit d90a3f0

Please sign in to comment.