Skip to content

Commit

Permalink
✨ Add ingress user support (#286)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Felkel <[email protected]>
  • Loading branch information
oli-f and Oliver Felkel authored Mar 22, 2022
1 parent c624f64 commit eb098c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions grocy/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ equal Sunday:
- `calendar_first_day_of_week`
- `meal_plan_first_day_of_week`

### Option: `grocy_ingress_user`

Allows you to specify a default ingress user if desired (e.g. `admin`).

If no ingress user is set, the default login authentication is used.

## Known issues and limitations

- Grocy support to provide custom lookup resources to lookup information
Expand Down
2 changes: 2 additions & 0 deletions grocy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ options:
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
grocy_ingress_user: ""
schema:
log_level: list(trace|debug|info|notice|warning|error|fatal)?
culture: list(ca|cs|da|de|el_GR|en|en_GB|es|fi|fr|he_IL|hu|it|ja|ko_KR|nl|no|pl|pt_BR|pt_PT|ru|sk_SK|sv_SE|ta|tr|zh_CN|zh_TW)
Expand Down Expand Up @@ -74,3 +75,4 @@ schema:
ssl: bool
certfile: str
keyfile: str
grocy_ingress_user: str
1 change: 1 addition & 0 deletions grocy/rootfs/etc/cont-init.d/nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Generate Ingress PHP-FPM configuration
bashio::var.json \
interface "$(bashio::addon.ip_address)" \
grocy_user "$(bashio::config 'grocy_ingress_user')" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf
Expand Down
7 changes: 7 additions & 0 deletions grocy/rootfs/etc/nginx/templates/ingress.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ server {
fastcgi_read_timeout 900;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;

{{ if .grocy_user }}
fastcgi_param GROCY_AUTH_CLASS "Grocy\Middleware\ReverseProxyAuthMiddleware";
fastcgi_param GROCY_REVERSE_PROXY_AUTH_HEADER REMOTE_USER;
fastcgi_param HTTP_REMOTE_USER {{ .grocy_user }};
{{ end }}

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/includes/fastcgi_params.conf;
}
Expand Down

0 comments on commit eb098c9

Please sign in to comment.