Compare commits
5 Commits
e05aa849c7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
ecccb84e82
|
|||
| 4993d6e05d | |||
|
8906cd9678
|
|||
|
f58d8ef280
|
|||
|
da6abf0cbe
|
@@ -3,8 +3,10 @@ name: build
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches:
|
||||||
- main
|
- '**'
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Go-Build:
|
Go-Build:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ name: docker
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
tags:
|
||||||
- 'main'
|
- '**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
|
|||||||
+3
-1
@@ -16,4 +16,6 @@ RUN apt update && apt install -y curl tar \
|
|||||||
&& mv resvg /usr/local/bin/resvg \
|
&& mv resvg /usr/local/bin/resvg \
|
||||||
&& chmod +x /usr/local/bin/resvg
|
&& chmod +x /usr/local/bin/resvg
|
||||||
COPY --from=builder /app/svg-templater /usr/local/bin/svg-templater
|
COPY --from=builder /app/svg-templater /usr/local/bin/svg-templater
|
||||||
CMD ["svg-templater"]
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CMD="svg-templater"
|
||||||
|
|
||||||
|
if [ -n "$API_KEY" ]; then
|
||||||
|
CMD="$CMD --frontendkey $API_KEY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$DATA_DIR" ]; then
|
||||||
|
CMD="$CMD --data $DATA_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval exec $CMD "$@"
|
||||||
@@ -104,9 +104,18 @@ func getPublicUrl(r *http.Request, subpath string) string {
|
|||||||
Host: r.Host,
|
Host: r.Host,
|
||||||
Path: path.Join("public", subpath),
|
Path: path.Join("public", subpath),
|
||||||
}
|
}
|
||||||
newURL.Scheme = "http"
|
newURL.Scheme = determineScheme(r)
|
||||||
if r.TLS != nil {
|
|
||||||
newURL.Scheme = "https"
|
|
||||||
}
|
|
||||||
return newURL.String()
|
return newURL.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func determineScheme(r *http.Request) string {
|
||||||
|
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
|
||||||
|
return proto
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.TLS != nil {
|
||||||
|
return "https"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "http"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user