Commit Graph

1 Commits

Author SHA1 Message Date
deepakdeore2004 e673346bb8 Support to read environment variables from file in init containers (#993)
### Description of the change

Gitea supports providing DB and Redis/ValKey secrets via env variables, current chart requires DB and Redis/ ValKey credentials reading from k8s secret as per below values.yaml snippet. This approach requires secret to be created beforehand.

```
    - name: GITEA__database__USER
      valueFrom:
        secretKeyRef:
          name: gitea-ha
          key: db_user
    - name: GITEA__database__PASSWD
      valueFrom:
        secretKeyRef:
          name: gitea-ha
          key: db_password
```

Other approach is to provide the credentials in values.yaml which isnt secure.

A bash variable file can be created by using vault injector like this, which then can be sourced while running `config_environment.sh` in `init-app-ini`
```
GITEA__database__NAME=gitea
GITEA__database__USER=gitea_user
```

Support to read env variables from file
Reference: https://developer.hashicorp.com/vault/docs/deploy/kubernetes/injector/examples#environment-variable-example

### Benefits

Support to read env variables from file created by vault injector for DB and redis/ valkey credentials
Support to set gitea admin user and credentials via env variables from file created by vault injector

### Possible drawbacks

N/A

### ⚠ BREAKING

No breaking changes

### Checklist

- [X] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/993
Co-authored-by: deepakdeore2004 <deepakdeore2004@noreply.gitea.com>
Co-committed-by: deepakdeore2004 <deepakdeore2004@noreply.gitea.com>
2026-03-12 19:12:26 +00:00