From 2837574abdff32f2d4e593850b8761ba87d5e346 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Sun, 28 Jul 2024 14:37:24 +0200 Subject: [PATCH] unfinished makefile stuff --- Makefile | 17 +++++++++++++++++ cmd/certwarden-deploy/main.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 Makefile create mode 100644 cmd/certwarden-deploy/main.go diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2a4e661 --- /dev/null +++ b/Makefile @@ -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) diff --git a/cmd/certwarden-deploy/main.go b/cmd/certwarden-deploy/main.go new file mode 100644 index 0000000..9565aa6 --- /dev/null +++ b/cmd/certwarden-deploy/main.go @@ -0,0 +1,31 @@ +/* +Copyright © 2024 Laura Kalb +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") + +}