Skip to content

GH-213: enhance WorkspaceUtil to also search in envrionment variables#214

Merged
francoisledroff merged 3 commits into
adobe:GH-213from
nicdard:GH-213
Feb 1, 2024
Merged

GH-213: enhance WorkspaceUtil to also search in envrionment variables#214
francoisledroff merged 3 commits into
adobe:GH-213from
nicdard:GH-213

Conversation

@nicdard

@nicdard nicdard commented Jan 31, 2024

Copy link
Copy Markdown
Collaborator

See: #213

Description

As described in the issue, added the possibility to get the configuration for the Workspace from environment variables, which makes it easier to use.

Related Issue

#213

Motivation and Context

Enable the usage of environment variables in docker containers where an entrypoint is defined in exec form, passing the configurations through ENV variables without the need to bind them using the system properties, which turns out to be really cumbersome.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

try {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();
String providerId = WorkspaceUtil.getSystemProperty(AIO_PROVIDER_ID);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

don't you want to load these other AIO_* property using the same pattern ? and augment getSystemProperty with System.getEnv() ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ah sure!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done


public static void main(String[] args) {
try {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would favor keeping the same interface/method-name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok I'll revert back the change

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@francoisledroff francoisledroff merged commit 4a53673 into adobe:GH-213 Feb 1, 2024
@nicdard nicdard deleted the GH-213 branch February 2, 2024 13:24
francoisledroff added a commit that referenced this pull request Feb 12, 2024
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.

2 participants