Skip to content

Latest commit

 

History

History

docker-rest-user-service

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Choreo Sample REST API - User Store

Use the following commands to create BYOI component

  • Select Create Component with Service type.
  • Provide component name and description.
  • Select Deploy an image from a Container Registry as the source.
  • Select User Service tile and create component.

Use the following endpoint configuration when creating endpoints for the component:

Use the following configuration when creating this component in Choreo:

  • Build Pack: Dockerfile
  • Dockerfile Path: docker-rest-user-service/Dockerfile
  • Docker Context Path: docker-rest-user-service

The endpoints.yaml file contains the endpoint configurations that are used by the Choreo to expose the service.

Run the service locally

go run main.go

Generate API definitions

Generated using Go annotations https://github.com/swaggo/swag

  1. Download swag CLI tool by running:
    go install github.com/swaggo/swag/cmd/[email protected]
  2. Run the following command to generate the API definitions:
    swag fmt && swag init

Service Configurations (optional)

Refer config.go file for the available configurations.

For more information on how to configure a service in Choreo, refer Manage Configurations and Secrets documentation.

Load initial data ( optional )

  1. Set environment variable by navigating to Choreo Deploy page INIT_DATA_PATH=configs/initial_data.json
  2. Mount the file contents of configs/initial_data.json in the path specified in step 1.

See initial_data.json for a sample file.