Minor UI suggestion - add some explanatory text on how to set environment variables

Created on 29 February 2024, 4 months ago
Updated 3 June 2024, 26 days ago

Problem/Motivation

The Key module allows users to retrieve a key from an environment variable.

However, the form to set the environment variable's name doesn't explain how an environment variable can be set (i.e. via putenv() or web server configuration), nor does it clarify whether any special naming convention is needed.

(Of course, I appreciate that once you know how to do this it seems blindingly obvious.)

Steps to reproduce

Go to the Keys admin overview page, click "+ Add a key", and choose "Environment" as the key provider. Note that no information on how to set/test a key is provided.

Proposed resolution

Add a little explanatory text in the add key form and in the Readme to help those new to managing keys:

Remaining tasks

Sanity check if this is a good idea :)

Also, review the wording in the supplied patch - I suspect we may need to add a message outlining that environment variables should be set in the web server config in production; the putenv() example is only intended for local testing.

User interface changes

Wording in the Readme and on the configuration form.

API changes

None.

Data model changes

None.

Feel free to tell me this is a silly idea of course :)

/Alex

πŸ“Œ Task
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡¬πŸ‡§United Kingdom alexharries

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alexharries
  • πŸ‡―πŸ‡΅Japan ptmkenny

    I suspect we may need to add a message outlining that environment variables should be set in the web server config in production; the putenv() example is only intended for local testing.

    Yes, I think the on-screen documentation should describe how to handle the case for production, not dev.

    Environmental variables aren't a concept unique to key, and there are lots of ways to set them. It might be good to add a page to the docs giving an example of how to do this, or add a tutorial about how to debug this (using putenv() in settings.php as suggested here, or, since a lot of people are using ddev now, .ddev/.env).

Production build 0.69.0 2024