crossplane-contrib / crossplane-contrib/function-go-templating

Add a helper function to access composition environment variables

Open
#23 1 comment 1 reaction 0 assignees View on GitHub
enhancement good first issue
Dominant language
Go
Stars
100
Forks
65
Avg merge
2d 6h
Merged PRs (30d)
9

Description

### What problem are you facing?

Currently, we can access composition environment variables like:
```
env: {{ (index .context "apiextensions.crossplane.io/environment").key1 }}
```
However, this is too verbose and can be simplified with a helper function.

### How could this Function help solve your problem?

To make it easier to access composition environment variables, we can have a helper function called `getCompositionEnvVar`. The interface might be like:

```
env: {{ getCompositionEnvVar . "key1" }}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or entry points. Start by locating how template helper functions are registered and how composition environment values are exposed, then compare the proposed `getCompositionEnvVar . "key1"` call with the existing `.context` access. Done means the helper works for the shown key and has coverage for its expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.