Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(infra): Add missing infra in api and auth-admin-api #15976

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Conversation

saevarma
Copy link
Member

@saevarma saevarma commented Sep 12, 2024

What

👆

Why

To fix api and auth-admin-api.

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced environment-specific API paths for authentication, enhancing flexibility across development, staging, and production environments.
    • Integrated with the X-Road infrastructure for improved service capabilities related to procuring services.
  • Configuration Updates

    • Added explicit API paths for administrative authentication in development, staging, and production configurations, improving clarity and accessibility for developers.

@saevarma saevarma requested a review from a team as a code owner September 12, 2024 14:39
Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Walkthrough

The pull request introduces several configuration updates across various environment files and service setup functions. It adds the AUTH_ADMIN_API_PATH variable to specify distinct API endpoint URLs for dev, staging, and prod environments. Additionally, it incorporates the XROAD_RSK_PROCURING_PATH variable in the production and staging configurations, enhancing the service's interaction capabilities with the X-Road infrastructure. These changes collectively improve the application's environment-specific configurations and service integration.

Changes

Files Change Summary
apps/api/infra/api.ts Added AUTH_ADMIN_API_PATH with environment-specific URLs for dev, staging, and prod.
apps/services/auth/admin-api/infra/auth-admin-api.ts Added .xroad(RskProcuring) in the serviceSetup function to integrate with X-Road infrastructure.
charts/identity-server/values.dev.yaml Added AUTH_ADMIN_API_PATH: 'https://identity-server.dev01.devland.is/backend'.
charts/identity-server/values.prod.yaml Added XROAD_RSK_PROCURING_PATH: 'IS/GOV/5402696029/Skatturinn/relationships-v1'.
charts/identity-server/values.staging.yaml Added XROAD_RSK_PROCURING_PATH: 'IS-TEST/GOV/5402696029/Skatturinn/relationships-v1'.
charts/islandis/values.prod.yaml Added AUTH_ADMIN_API_PATH: 'https://innskra.island.is/backend'.
charts/islandis/values.staging.yaml Added AUTH_ADMIN_API_PATH: 'https://identity-server.staging01.devland.is/backend'.

Possibly related PRs


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1c5dc57 and 5c41d4f.

Files selected for processing (8)
  • apps/api/infra/api.ts (1 hunks)
  • apps/services/auth/admin-api/infra/auth-admin-api.ts (2 hunks)
  • charts/identity-server/values.dev.yaml (1 hunks)
  • charts/identity-server/values.prod.yaml (1 hunks)
  • charts/identity-server/values.staging.yaml (1 hunks)
  • charts/islandis/values.dev.yaml (1 hunks)
  • charts/islandis/values.prod.yaml (1 hunks)
  • charts/islandis/values.staging.yaml (1 hunks)
Additional context used
Path-based instructions (2)
apps/services/auth/admin-api/infra/auth-admin-api.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/api/infra/api.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (10)
apps/services/auth/admin-api/infra/auth-admin-api.ts (2)

7-7: LGTM!

The import statement for RskProcuring from the xroad module is correctly written. It's likely used in the serviceSetup function to integrate with the X-Road infrastructure, as mentioned in the AI-generated summary.


70-70: LGTM!

The .xroad(RskProcuring) method is correctly chained to the service builder configuration in the serviceSetup function. This change indicates that the service is now set up to interact with the RskProcuring component, enhancing its functionality by integrating with the X-Road infrastructure. The overall structure of the service setup remains intact, but the addition of this integration point suggests an expansion of capabilities related to procuring services. The PR objectives and AI-generated summary align with this change, indicating that it's an intended enhancement to the service's interaction capabilities with the X-Road infrastructure.

apps/api/infra/api.ts (2)

210-214: LGTM!

The addition of the AUTH_ADMIN_API_PATH configuration with environment-specific URLs enhances the flexibility and maintainability of the service setup. It allows the application to interact with the correct backend services based on the deployment environment.


Line range hint 215-229: Verify the usage of AUTH_ADMIN_API_PATHS.

The addition of the AUTH_ADMIN_API_PATHS configuration provides a more granular way to specify the authentication admin API paths for different environments within the same deployment environment. This can be useful for testing or staging purposes.

Please ensure that the application code is updated to utilize this new configuration correctly.

Run the following script to verify the usage of AUTH_ADMIN_API_PATHS:

Verification successful

Verification Successful: AUTH_ADMIN_API_PATHS is utilized correctly.

The AUTH_ADMIN_API_PATHS configuration is used in libs/clients/auth/admin-api/src/lib/auth-admin-api-client.config.ts to set basePaths with environment variables, confirming its integration into the application logic.

  • libs/clients/auth/admin-api/src/lib/auth-admin-api-client.config.ts: Usage of AUTH_ADMIN_API_PATHS for setting basePaths.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `AUTH_ADMIN_API_PATHS` configuration.

# Test: Search for the usage of `AUTH_ADMIN_API_PATHS`. Expect: At least one occurrence.
rg --type typescript -A 5 $'AUTH_ADMIN_API_PATHS'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify the usage of `AUTH_ADMIN_API_PATHS` configuration.

# Test: Search for the usage of `AUTH_ADMIN_API_PATHS`. Expect: At least one occurrence.
rg --type ts -A 5 $'AUTH_ADMIN_API_PATHS'

Length of output: 1045

charts/identity-server/values.prod.yaml (1)

228-228: Verify the usage of the new XROAD_RSK_PROCURING_PATH variable.

The addition of the XROAD_RSK_PROCURING_PATH environment variable to the services-auth-admin-api configuration looks good. It likely enables new functionality or interactions related to procuring actor relationships.

To ensure the variable is being utilized correctly, please run the following script:

charts/identity-server/values.staging.yaml (1)

231-231: LGTM!

The addition of the XROAD_RSK_PROCURING_PATH environment variable to the services-auth-admin-api configuration looks good. It appears to be a valid enhancement to the API's functionality related to procuring actor relationships within the specified government context.

charts/identity-server/values.dev.yaml (1)

231-231: LGTM!

The addition of the XROAD_RSK_PROCURING_PATH environment variable to the services-auth-admin-api configuration looks good. It follows the expected naming convention and format for specifying an X-Road service identifier.

This change suggests an enhancement or expansion of the API's capabilities, potentially enabling new interactions or data retrieval processes associated with the specified procuring path.

charts/islandis/values.staging.yaml (1)

282-282: LGTM!

The addition of the AUTH_ADMIN_API_PATH configuration entry for the staging environment looks good. It correctly specifies the URL for the identity server's admin API.

charts/islandis/values.prod.yaml (1)

272-272: Verify the production URL and consider future refactoring.

The addition of AUTH_ADMIN_API_PATH improves clarity by explicitly specifying the admin API endpoint for the production environment. Please ensure that the URL https://innskra.island.is/backend matches the actual production URL.

In the future, consider removing the production URL from AUTH_ADMIN_API_PATHS to eliminate redundancy, as long as it doesn't impact other environments.

charts/islandis/values.dev.yaml (1)

282-282: LGTM!

The addition of the AUTH_ADMIN_API_PATH configuration entry enhances clarity by explicitly defining the API path for administrative authentication in the development environment. It complements the existing AUTH_ADMIN_API_PATHS variable.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@peturgq peturgq added the automerge Merge this PR as soon as all checks pass label Sep 12, 2024
@kodiakhq kodiakhq bot merged commit 123c86b into main Sep 12, 2024
30 checks passed
@kodiakhq kodiakhq bot deleted the api/update-infra branch September 12, 2024 14:47
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants