Skip to content

feat: require explicit environment and add Spring Boot starter module#36

Merged
jhateley-godaddy merged 7 commits intogodaddy:mainfrom
hmaheshwari-godaddy:pr/required-env-and-spring-boot-starter
Apr 8, 2026
Merged

feat: require explicit environment and add Spring Boot starter module#36
jhateley-godaddy merged 7 commits intogodaddy:mainfrom
hmaheshwari-godaddy:pr/required-env-and-spring-boot-starter

Conversation

@hmaheshwari-godaddy
Copy link
Copy Markdown
Contributor

Summary

  • Breaking: AnsConfiguration.builder().build() now throws IllegalStateException if .environment() is not set. This prevents production deployments from silently using OTE.
  • New module: ans-sdk-spring-boot-starter provides Spring Boot auto-configuration, binding ans.* properties to SDK beans (AnsConfiguration, RegistrationClient, DiscoveryClient).
  • Example: Spring Boot app under ans-sdk-spring-boot-starter/examples/spring-boot-app/ demonstrating injected SDK usage.

Changes

Required environment (feat!)

  • AnsConfiguration.Builder.environment default changed from Environment.OTE to null
  • build() validates that environment is explicitly set
  • All downstream tests updated to pass .environment(Environment.OTE)

Spring Boot starter (feat)

  • AnsProperties@ConfigurationProperties(prefix = "ans") with environment, credentials, timeouts, retries
  • AnsAutoConfiguration — creates AnsCredentialsProvider, AnsConfiguration, RegistrationClient, DiscoveryClient beans
  • Supports credential types: jwt, api-key, environment
  • All beans use @ConditionalOnMissingBean for user overrides
  • 13 auto-configuration tests using ApplicationContextRunner
  • Example Spring Boot app with REST controller

Test plan

  • ./gradlew build passes (89 tasks, all green)
  • Checkstyle zero warnings
  • Auto-configuration tests cover: all credential types, missing fields, custom timeouts, disabled flag, user bean overrides
  • Example app compiles and produces bootJar

@jhateley-godaddy jhateley-godaddy self-requested a review April 7, 2026 21:47
Copy link
Copy Markdown
Collaborator

@jhateley-godaddy jhateley-godaddy left a comment

Choose a reason for hiding this comment

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

LGTM

   Cover Builder.configuration() with pre-built config and edge cases in
   extractAgentDetailsLink (missing links field, no matching rel).
Copy link
Copy Markdown
Collaborator

@jhateley-godaddy jhateley-godaddy left a comment

Choose a reason for hiding this comment

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

LGTM

@jhateley-godaddy jhateley-godaddy merged commit 7290242 into godaddy:main Apr 8, 2026
1 check 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