Skip to content

dungnh3/guardrails-assignment

Repository files navigation

guardrails-assignment

Prerequisites

Before you continue, ensure you meet the following requirements:

Dependencies

- Docker
- Go 1.17
- PostgreSQL 12

Create instance database

make init-db

Start server

Default server always start in port: 10080. Please change configure in /config/default.go if you want to start with new port

go run cmd/main.go server

Document swagger

http://localhost:10080/swagger-ui

Start scanner job

go run cmd/main.go scanner

Installation buf

The following instructions assume you are using Buf Docs Installation

brew tap bufbuild/buf
brew install buf

Installation grpc

The following instructions assume you are using Go Modules for dependency management. Use a tool dependency to track the versions of the following executable packages:

// +build tools

package tools

import (
    _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
    _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
    _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
    _ "google.golang.org/protobuf/cmd/protoc-gen-go"
)

Run go mod tidy to resolve the versions.

Install by running

go install \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
    google.golang.org/protobuf/cmd/protoc-gen-go \
    google.golang.org/grpc/cmd/protoc-gen-go-grpc

This will place four binaries in your $GOBIN;

  • protoc-gen-grpc-gateway
  • protoc-gen-openapiv2
  • protoc-gen-go
  • protoc-gen-go-grpc

Make sure that your $GOBIN is in your $PATH.

Alternatively, see the section on remotely managed plugin versions below.

Generate code

buf generate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published