-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cd44d3
commit 9d72451
Showing
4 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
package middleware | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/labstack/echo/v4" | ||
"github.com/labstack/echo/v4/middleware" | ||
) | ||
|
||
// GZIP is ready-to-go GZIP middleware based on echo middleware | ||
var GZIP = middleware.GzipWithConfig(middleware.GzipConfig{Level: 5}) | ||
// GZIP is ready-to-go GZIP middleware with a skipper to exclude certain routes | ||
var GZIP = middleware.GzipWithConfig(middleware.GzipConfig{ | ||
Level: 5, | ||
Skipper: func(c echo.Context) bool { | ||
// Skip GZIP compression for routes starting with /features | ||
// as compression messes with pg_featureserv | ||
return strings.Contains(c.Request().URL.Path, "/features") | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM pramsey/pg_featureserv:20241119 | ||
|
||
# Copy your entrypoint script into the container | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
# Default command of pg_featureserv | ||
CMD ["./pg_featureserv"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Construct the DATABASE_URL using environment variables | ||
export DATABASE_URL="postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE}" | ||
|
||
# Debug - DO NOT enable this and commit, we don't want it in the AWS logs) | ||
# echo "DATABASE_URL is: $DATABASE_URL" | ||
|
||
# Now, execute the default command (pg_featureserv or any other service) | ||
exec "$@" |