Skip to content

Conversation

@MadhukarMoogala
Copy link
Collaborator

feat: bump minor version to add support for APS environment variables

  • Introduced AddAPSAlternativeEnvironmentVariables extension method to add APS environment variables to the configuration builder.
  • Created APSAlternativeConfigurationSource class to represent the configuration source for APS.
  • Implemented APSAlternativeConfigurationProvider class to load APS configuration from environment variables.

Add unit tests for APS alternative environment variables

  • Added TestValuesFromAPSEnvironment to verify loading of APS environment variables.
  • Ensured tests cover various configuration sources including environment variables, JSON, and legacy environment variables.

@MadhukarMoogala
Copy link
Collaborator Author

Summary

This PR introduces APS configuration handling with new unit tests, alternative APS environment variable support.

Changes

  • Unit Tests for APS Configuration:

    • TestAPSConfigFromEnvironmentVariables_DoubleUnderscoreFormat: Tests loading of APS environment variables in double underscore format.
    • TestAPSConfigFromEnvironmentVariables_UnderscoreFormat: Tests loading of APS environment variables in underscore format.
    • TestAPSConfigFromJson: Tests loading APS configuration from JSON.
    • TestAPSConfigFromJsonWithAgents: Tests loading APS configuration with additional agents from JSON.
    • TestAPSUserAgent: Verifies APS configuration for user agent "user1" with authentication and request handling.
  • APS Environment Variable Support:

    • Added AddAPSAlternativeEnvironmentVariables to support APS-specific environment variables.
    • Implemented APSAlternativeConfigurationSource and APSAlternativeConfigurationProvider to load APS settings from environment variables.
    • Marked AddForgeAlternativeEnvironmentVariables as obsolete for transition to APS naming.
  • Service Collection Enhancements:

    • Updated AddForgeService to support APS configurations in both "Forge" and "APS" sections, ensuring backward compatibility.

This PR ensures smooth migration from Forge to APS naming conventions.

public static IHttpClientBuilder AddForgeService(this IServiceCollection services, IConfiguration configuration)
{
services.AddOptions();
services.Configure<ForgeConfiguration>(configuration.GetSection("Forge"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

@szilvaa is there some way to get a warning on this too? e.g. if the user still defines Forge in appsettings.json

Copy link
Collaborator

Choose a reason for hiding this comment

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

We would need to add our own .targets file to the nuget package that would check the user appsettings.json to see if they still use this old stuff. So, it is possible, but it isn't trivial.

Copy link
Collaborator

@zhuliice zhuliice left a comment

Choose a reason for hiding this comment

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

thanks for the work!

@MadhukarMoogala MadhukarMoogala merged commit 10cbd08 into Autodesk-Forge:main Nov 12, 2024
2 checks passed
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.

3 participants