Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Adds a method to retrieve the environment variable name for any parameter, enabling programmatic access to env var names for documentation, help text, and configuration tooling.

Implementation

  • Generator template (generate/param_generator.go):

    • Added paramNameToEnvVar() helper: replaces dots with underscores, uppercases, prepends PELICAN_
    • Added GetEnvVarName() method to all param types: StringParam, StringSliceParam, IntParam, BoolParam, DurationParam, ObjectParam
  • Generated code (param/parameters.go): Contains method implementations for all parameter instances

  • Tests (param/param_test.go): Unit tests and viper integration test

Usage

// Get env var name for any parameter
envVar := param.Cache_Port.GetEnvVarName()
// Returns: "PELICAN_CACHE_PORT"

// Use in help text or documentation
fmt.Printf("Configure via: export %s=8443\n", param.Cache_Port.GetEnvVarName())

// Works with all parameter types
param.Federation_DiscoveryUrl.GetEnvVarName()  // "PELICAN_FEDERATION_DISCOVERYURL"
param.TLSSkipVerify.GetEnvVarName()            // "PELICAN_TLSSKIPVERIFY"
Original prompt

This section details on the original issue you should resolve

<issue_title>The param package should provide a getter for environment variables</issue_title>
<issue_description>Given a param like param.SomeThing, we should provide a method on the param that returns a string representing that param's Pelicanized environment variable, e.g.

envVarName := param.Some_Thing.GetEnvVarName()
// envVarName holds PELICAN_SOME_THING
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 22, 2026 21:37
Co-authored-by: jhiemstrawisc <75916364+jhiemstrawisc@users.noreply.github.com>
Co-authored-by: jhiemstrawisc <75916364+jhiemstrawisc@users.noreply.github.com>
Copilot AI changed the title [WIP] Add getter for environment variables in param package Add GetEnvVarName() method to parameter types Jan 22, 2026
Copilot AI requested a review from jhiemstrawisc January 22, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The param package should provide a getter for environment variables

2 participants