diff --git a/README.md b/README.md index 4ed8025..2d16964 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,14 @@ Create interactive applications with Golang, HTMX, and Templ - [Table of content](#table-of-content) - [Installation](#installation) - [Getting started](#getting-started) + - [Application structure](#application-structure) + - [assets](#assets) + - [conf](#conf) + - [db](#db) + - [events](#events) + - [handlers](#handlers) + - [types](#types) + - [views](#views) - [Development server](#development-server) - [Hot reloading the browser](#hot-reloading-the-browser) - [Migrations](#migrations) @@ -16,6 +24,7 @@ Create interactive applications with Golang, HTMX, and Templ - [Seeds](#seeds) - [Testing](#testing) - [Testing handlers](#testing-handlers) +- [Create a production release](#create-a-production-release) # Installation ``` @@ -33,6 +42,15 @@ cd [myprojectname] ``` # Getting started +## Application structure +### assets +### conf +### db +### events +### handlers +### types +### views + ## Development server Run the development server with the following command: ``` @@ -72,4 +90,16 @@ This command will run the seeds file located at `cmd/scripts/seed/main.go` # Testing ## Testing handlers +# Create a production release +Gothkit will compile your whole application including its assets into a single binary. To build your application for production you can run the following command: +``` +make build +``` +This will create a binary file located at `/bin/app_release`. + +Make sure you also set the correct application environment variable in your `.env` file. +``` +APP_ENV = production +``` + diff --git a/bootstrap/.env b/bootstrap/.env index 1e928c5..8652990 100644 --- a/bootstrap/.env +++ b/bootstrap/.env @@ -1,7 +1,7 @@ # Application environment # production # development -KIT_ENV = development +APP_ENV = development # HTTP listen port of the application HTTP_LISTEN_ADDR = :3000 diff --git a/kit/kit.go b/kit/kit.go index 03bcc20..ea5c7d9 100644 --- a/kit/kit.go +++ b/kit/kit.go @@ -130,13 +130,13 @@ func WithAuthentication(config AuthenticationConfig, strict bool) func(http.Hand } func IsDevelopment() bool { - return os.Getenv("KIT_ENV") == "development" + return os.Getenv("APP_ENV") == "development" } func IsProduction() bool { - return os.Getenv("KIT_ENV") == "production" + return os.Getenv("APP_ENV") == "production" } func Env() string { - return os.Getenv("KIT_ENV") + return os.Getenv("APP_ENV") }