a8m / a8m/envsubst

Feature Request - Loop by pattern matching.

Aperta
#5 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
907
Fork
96
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have a case where I need to create multiple entries in a config file based on the existence of environment variables. (its for a reverse proxy and I want to be able to add new entries simply by adding additional environment variables)

Something like:

**Env Vars:**
```
SRVCS_FIRST_HOSTNAME=sample.service.com
SRVCS_FIRST_DEST=internal.server.name
SRVCS_SECOND_HOSTNAME=second.service.com
SRVCS_SECOND_DEST=internal2.server.name
```

**Template:**
```
${SRVCS_*_<
host: ${HOSTNAME}
destination: ${DEST}

>}
```

**Result:**
```
host: sample.service.com
destination: internal.server.name

host: second.service.com
destination: internal2.server.name

```

Any thoughts on this idea? _I_ think it'd be pretty handy.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Look at the existing substitution logic in the Go codebase, likely in a main package or command. Understand how environment variables are currently parsed and replaced. The feature requires adding pattern matching to iterate over groups of variables (like SRVCS_*_HOSTNAME and SRVCS_*_DEST) and generating repeated blocks. Check if there are existing tests for expansion to see the expected behavior and add new tests for the loop feature.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go, shell
Ambito
cli, tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.