Skip to content

HARMONY-2168: Make sure the environment variable ENVIRONMENT does not override the harmony environment#118

Merged
chris-durbin merged 1 commit into
mainfrom
harmony-2168
Aug 25, 2025
Merged

HARMONY-2168: Make sure the environment variable ENVIRONMENT does not override the harmony environment#118
chris-durbin merged 1 commit into
mainfrom
harmony-2168

Conversation

@chris-durbin

Copy link
Copy Markdown
Contributor

Jira Issue ID

HARMONY-2168

Fixes #116

Description

When constructing a Harmony Client the ENVIRONMENT env var was incorrectly overriding the desired harmony environment. This PR changes the code to ignore the ENVIRONMENT env var so that the behavior is to use the environment passed into the client constructor or default to production if no environment is passed in.

Local Test Steps

This should fail on the main branch but pass in this branch.

import os

os.environ['ENVIRONMENT'] = 'foo'
harmony_client = Client() 

assert harmony_client.config.environment == Environment.PROD
assert harmony_client.config.harmony_hostname == 'harmony.earthdata.nasa.gov'

You can test other combinations like harmony_client = Client(should_validate_auth=False, env=Environment.UAT) as well.

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

… override the harmony environment used in client configuration.

@indiejames indiejames left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally

@chris-durbin chris-durbin merged commit a47796f into main Aug 25, 2025
11 checks passed
@chris-durbin chris-durbin deleted the harmony-2168 branch August 25, 2025 15:17
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.

Config object overly defers to environmental variables

3 participants