gogetter

command module
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 6 Imported by: 0

README

GoGetter - Sensible Go Modules and CLI Tool

GoGetter is a collection of reusable Go modules, pre-configured to work with Uber's Fx Framework. The aim is to provide a way to rapidly spin up service(s) using pre-built modules. This repository also includes a CLI tool to streamline common development tasks.

All modules are dependent on:

Modules

Usage

To use the modules in your project, simply import them from main, set up the configurations, and initiate them in your Fx App.

Configuration

There are 3 levels of configuration, listed in order of precedence:

  1. Environmental variables:
    • Format: prefix_scope_key
    • Separator: _ (underscore)
  2. Config Files
    • Format: scope.key
    • Separator: .
  3. Fallback Config
    • Format: scope.key
    • Separator: .
Injection

Refer to the template/example file for a working example.

Per Module Documentation

COMING SOON!

CLI

The CLI tool, built with Cobra, is a convenient way to spin up an entire service in one go.

Usage

To use the CLI tool, install it first:

go install github.com/alsey89/gogetter/cmd/gogetter@latest
Init

Init initializes the project. It sets up go module, creates a main.go file and installs the relevant dependencies.

gogetter init

Here's an example of how the process goes:

? Welcome to the GoGetter CLI. This will begin the setup process for your new Go service. Continue? Yes
? Enter the go module name for your project. [Example: github.com/alsey89/gogetter] testproject
? Enter the directory for your project. Service will be initiated at the current directory if left empty.
? Do you want to include a JWT middleware module? Yes
? Do you want to include a database module with Postgres and GORM? Yes
? Do you want to include a mailer module using Gomail? Yes
? Do you want to set up git for the project? Yes
? Do you want to set up docker for the project? Yes
? Do you want a docker-compose setup for local development? This will set up a docker-compose file for a local postgres and server with volume mapping. You can add the frontend yourself if you want. Yes
Run

Run spins up the docker-compose service, defaulting to a dev setup with automatic rebuild and reload.

gogetter run

Arguments:

  • dev: sets BUILD_ENV=development
  • development: sets BUILD_ENV=development
  • prod: sets BUILD_ENV=production
  • production: sets BUILD_ENV=production

Effects: Check the Dockerfile template to see how the BUILD_ENV affects the container setup.

Troubleshooting

If the command is not found after installation, check Go Environmental variables and system $PATH.

Contribution

Contributions are welcome! Please fork the repository and submit pull requests with your proposed changes. For major changes, please open an issue first to discuss what you would like to change.

Ensure to update tests as appropriate.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
config
database
jwt
logging
zap
mail
server

Jump to

Keyboard shortcuts

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