hasura / hasura/graphql-engine

feat(c/v3-engine): prefix `$` for "values" instead of the suffix `FromEnv` for "keys"

Open
#10,593 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Component

c/v3-engine

### Is your proposal related to a problem?

The suffix `~FromEnv` is used as a convention for environment variables.

For instance, in the example below, `value` should be refactored to `valueFromEnv` to use an env var.

```diff
kind: AuthConfig
definition:
mode:
jwt:
key:
fixed:
key:
+ valueFromEnv: AUTH_SECRET_AS_ENV_VAR
- value: "raw-value"
```

But sometimes, there's no `~FromEnv` field.
For example, the snippet below does not work, as there is no field like `jwkFromEnv`.

```diff
kind: AuthConfig
definition:
mode:
jwt:
key:
+ jwkFromEnv: JWK_URL_AS_ENV_VAR
- jwk: "https://hard-coded-url.com"
```

In such cases, users should report and request a new feature, like https://github.com/hasura/graphql-engine/issues/10592.
This is a bottleneck between core developers and consumers.

### Describe the solution you'd like

What if we introduce a prefix like `$` for **values**, instead of the suffix `FromEnv` for **keys**?
For example, the field `jwk` is still used, but the value is changed to `$JWK_URL_AS_ENV_VAR`.
This indicates it should be interpreted as an env var.

```diff
kind: AuthConfig
definition:
mode:
jwt:
key:
+ jwk: $JWK_URL_AS_ENV_VAR
- jwk: "https://hard-coded-url.com"
```

Of course, `jwk` is just an example. We can apply the new convention everywhere.

Contributor guide

Open the contributing guide

Research direction

The issue targets c/v3-engine and the AuthConfig JWT key examples, but names no implementation files, entry points, or tests. Start by locating the existing `FromEnv` handling for these configuration values; done means the proposed `$` value convention is consistently defined and verified across the affected engine inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
authentication, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.