unfinished makefile stuff

This commit is contained in:
Adora Laura Kalb 2024-07-28 14:37:24 +02:00
parent e46d924907
commit 2837574abd
Signed by: adoralaura
SSH key fingerprint: SHA256:3XrkbR8ikAZJVtYfaUliX1MhmJYVAe/ocIb/MiDHBJ8
2 changed files with 48 additions and 0 deletions

17
Makefile Normal file
View file

@ -0,0 +1,17 @@
# Set the default Go build flags
GOFLAGS = -ldflags='-w -s -X main.Version=$(VERSION)'
# Build the application
build:
go build $(GOFLAGS) -o bin/mailcow-admin-aliases cmd/mailcow-admin-aliases/main.go
# Clean the build artifacts
clean:
rm -rf bin
# Run the application
run: build
./bin/mailcow-admin-aliases
# Set a version for the build
VERSION := $(shell git describe --tags --always)

View file

@ -0,0 +1,31 @@
/*
Copyright © 2024 Laura Kalb <dev@lauka.net>
The code of this project is available under the MIT license. See the LICENSE file for more info.
*/
package main
import (
"os"
"code.lila.network/adoralaura/certwarden-deploy/internal/cli"
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
)
var Version string
func main() {
err := cli.RootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
cli.RootCmd.PersistentFlags().BoolVarP(&configuration.VerboseLogging, "verbose", "v", false, "Enable verbose logging")
cli.RootCmd.PersistentFlags().BoolVarP(&configuration.DryRun, "dry-run", "d", false, "Just show the would-be changes without changing the file system (turns on verbose logging)")
cli.RootCmd.PersistentFlags().BoolVarP(&configuration.QuietLogging, "quiet", "q", false, "Disable any logging (if both -q and -v are set, quiet wins)")
cli.RootCmd.PersistentFlags().StringVarP(&configuration.ConfigFile, "config", "c", "/etc/certwarden-deploy/config.yaml", "Path to config file (default is /etc/certwarden-deploy/config.yaml)")
cli.RootCmd.PersistentFlags().BoolVarP(&configuration.Force, "force", "f", false, "Force overwriting and execution action to occur, regardless if certificate already exists")
}