Simplify generating configuration files
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
In my project I want to have deployed Grafana with custom dashboard (json file). Unfortuantelly Grafana does not provide a way to setup value of variables while importing them. When I deploy that to kubernetes I just map that json to config map apply new variables and letter create new json base on that.
### Describe the solution you'd like
It would be nice to have some simplified way to generate configuration files for resources. I noticed that such trick is already done for PgAdmin. So maybe having one of such methods would make sense:
```csharp
.WithBindFile("/var/lib/grafana/dashboards/my-dashboard.json", (ctx, filePath) =>
{
string json = File.ReadAllText(filePath);
JsonNode root = JsonNode.Parse(json);
root["$.my.attribute.path"] = otherResource.GetEndpoint("http").Url;
File.WriteAllText(filePath, root.ToString());
});
```
Or
```csharp
.WithBindFile("/pgadmin4/servers.json", ctx => new PgAdminServers
{
Name = pg.Name,
Group = "Servers",
Host = pg.PrimaryEndpoint.Host,
...
});
```
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.