-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add gomplate to the docker image #1893
Changes from all commits
7784a47
891fa17
e13aac4
d43053e
226c91d
a6cb627
3241fd4
7f74459
dd4a62e
715fee7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{- /* NOTE: This configuration file is an example and exists only for development purposes. */ -}} | ||
{{- /* To find more about gomplate formatting, please visit its documentation site - https://docs.gomplate.ca/ */ -}} | ||
issuer: {{ getenv "DEX_ISSUER" "http://127.0.0.1:5556/dex" }} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment that this config file is only an example / for development purposes? And maybe mention in another comment that for escaping "unfriendly" input like passwords, this function could be used for escaping, to get valid YAML? https://docs.gomplate.ca/functions/strings/#strings-squote There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that makes sense. Let's add a comment |
||
storage: | ||
type: sqlite3 | ||
config: | ||
file: {{ getenv "DEX_STORAGE_SQLITE3_CONFIG_FILE" "/var/dex/dex.db" }} | ||
|
||
web: | ||
{{- if getenv "DEX_WEB_HTTPS" "" }} | ||
https: {{ .Env.DEX_WEB_HTTPS }} | ||
tlsKey: {{ getenv "DEX_WEB_TLS_KEY" | required "$DEX_WEB_TLS_KEY in case of web.https is enabled" }} | ||
tlsCert: {{ getenv "DEX_WEB_TLS_CERT" | required "$DEX_WEB_TLS_CERT in case of web.https is enabled" }} | ||
{{- end }} | ||
http: {{ getenv "DEX_WEB_HTTP" "0.0.0.0:5556" }} | ||
|
||
{{- if getenv "DEX_TELEMETRY_HTTP" }} | ||
telemetry: | ||
http: {{ .Env.DEX_TELEMETRY_HTTP }} | ||
{{- end }} | ||
|
||
expiry: | ||
deviceRequests: {{ getenv "DEX_EXPIRY_DEVICE_REQUESTS" "5m" }} | ||
signingKeys: {{ getenv "DEX_EXPIRY_SIGNING_KEYS" "6h" }} | ||
idTokens: {{ getenv "DEX_EXPIRY_ID_TOKENS" "24h" }} | ||
authRequests: {{ getenv "DEX_EXPIRY_AUTH_REQUESTS" "24h" }} | ||
|
||
logger: | ||
level: {{ getenv "DEX_LOG_LEVEL" "info" }} | ||
format: {{ getenv "DEX_LOG_FORMAT" "text" }} | ||
|
||
oauth2: | ||
responseTypes: {{ getenv "DEX_OAUTH2_RESPONSE_TYPES" "[code]" }} | ||
skipApprovalScreen: {{ getenv "DEX_OAUTH2_SKIP_APPROVAL_SCREEN" "false" }} | ||
alwaysShowLoginScreen: {{ getenv "DEX_OAUTH2_ALWAYS_SHOW_LOGIN_SCREEN" "false" }} | ||
{{- if getenv "DEX_OAUTH2_PASSWORD_CONNECTOR" "" }} | ||
passwordConnector: {{ .Env.DEX_OAUTH2_PASSWORD_CONNECTOR }} | ||
{{- end }} | ||
|
||
enablePasswordDB: {{ getenv "DEX_ENABLE_PASSWORD_DB" "true" }} | ||
|
||
connectors: | ||
{{- if getenv "DEX_CONNECTORS_ENABLE_MOCK" }} | ||
- type: mockCallback | ||
id: mock | ||
name: Example | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh -e | ||
|
||
### Usage: /docker-entrypoint.sh <command> <args> | ||
function main() { | ||
executable=$1 | ||
command=$2 | ||
|
||
if [[ "$executable" != "dex" ]] && [[ "$executable" != "$(which dex)" ]]; then | ||
exec $@ | ||
fi | ||
|
||
if [[ "$command" != "serve" ]]; then | ||
exec $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this option, allowing it to bypass the templating by adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also adapt the section "Does this PR introduce a user-facing change?":
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right! Whole description has to be rewritten. |
||
fi | ||
|
||
for tpl_candidate in $@ ; do | ||
case "$tpl_candidate" in | ||
*.tpl|*.tmpl|*.yaml) | ||
tmp_file=$(mktemp /tmp/dex.config.yaml-XXXXXX) | ||
gomplate -f "$tpl_candidate" -o "$tmp_file" | ||
|
||
args="${args} ${tmp_file}" | ||
;; | ||
*) | ||
args="${args} ${tpl_candidate}" | ||
;; | ||
esac | ||
done | ||
exec $args | ||
} | ||
|
||
main $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use the slim version instead for a smaller binary: https://github.com/hairyhenderson/gomplate/releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, does this work with every arm version? arm64, armv7? (The first one is GOARCH, the latter is variant AFAIK)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does! I have tested with linux/arm/v7 and linux/arm64.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!