Skip to content

Commit

Permalink
Add a custom templates example in the documentation (#93)
Browse files Browse the repository at this point in the history
* Add a custom templates example in the documentation

Related to oauth2-proxy/oauth2-proxy#1507

* Update Chart.yaml

Co-authored-by: Pierluigi Lenoci <[email protected]>
Co-authored-by: Pierluigi Lenoci <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2022
1 parent 3c67889 commit dd38337
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/oauth2-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: oauth2-proxy
version: 6.2.5
version: 6.2.6
apiVersion: v2
appVersion: 7.3.0
home: https://oauth2-proxy.github.io/oauth2-proxy/
Expand Down
41 changes: 41 additions & 0 deletions helm/oauth2-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,44 @@ extraEnv:
- name: TEST_ENV_VAR_2
value: '{{ .Values.tplValue }}'
```
## Custom templates configuration
You can replace the default template files using a Kubernetes `configMap` volume. The default templates are the two files [sign_in.html](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/pkg/app/pagewriter/sign_in.html) and [error.html](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/pkg/app/pagewriter/error.html).

```yaml
config:
configFile: |
...
custom_templates_dir = "/data/custom-templates"
extraVolumes:
- name: custom-templates
configMap:
name: oauth2-proxy-custom-templates
extraVolumeMounts:
- name: custom-templates
mountPath: "/data/custom-templates"
readOnly: true
extraObjects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: oauth2-proxy-custom-templates
data:
sign_in.html: |
<!DOCTYPE html>
<html>
<body>sign_in</body>
</html>
error.html: |
<!DOCTYPE html>
<html>
<body>
<h1>error</h1>
<p>{{.StatusCode}}</p>
</body>
</html>
```

0 comments on commit dd38337

Please sign in to comment.