discount-calculator

command module
v0.0.0-...-3d01394 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 1 Imported by: 0

README

discount-calculator

This service is responsible for performing discount calculations for products following pre-established rules.

Architecture

  • Ready to integrate a microservice ecosystem
  • Written in GoLang
  • Communication with other services via gRPC and HTTP2

Building and running

This project makes use of profiles to define the execution settings. To run the application according to a specific profile, using any of the execution methods in the next sections, informing the profile in the go flag parameter -fprofile.

To run successfully, it is necessary to have a file named applicationProfileName.yml in the project resources folder.

In addition, this project is part of a larger project, which contains the complete execution via docker-compose.

To run it directly from this directory and make calls to the API, it is necessary to have the users-data application running.

Docker

To run the application through a docker container, execute the following command inside the project's root folder.

docker-compose up 

The default profile for running via the docker is local. If you want to use another profile, inform the PROFILE property before the command, as shown below:

PROFILE=prod docker-compose up

To run successfully, it is necessary to have a file named applicationProfileName.yml in the project resources folder.

Local Build
Building

To build the project, run the command below:

go build .
Running

To execute the project, run the command below:

go run main.go

The default profile for running via gradle is empty, referencing the standard application.yml file. If you want to use another profile, inform the -fprofile property after the command, as shown below:

go run main.go -fprofile=local

To run successfully, it is necessary to have a file named applicationProfileName.yml in the project resources folder.

Development

Generating proto files

Installing compiler:

sudo apt install -y protobuf-compiler

For more information, click here.

Running make routine:

# GNU Make - Copyright (C) 1988-2014 Free Software Foundation, Inc.
make proto

License

MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL