add makefile

This commit is contained in:
Adora Laura Kalb 2024-07-30 08:42:51 +02:00
parent e46d924907
commit 05a536a17d
Signed by: adoralaura
SSH key fingerprint: SHA256:3XrkbR8ikAZJVtYfaUliX1MhmJYVAe/ocIb/MiDHBJ8
6 changed files with 40 additions and 41 deletions

41
.gitignore vendored
View file

@ -1,31 +1,28 @@
# ---> Go # Allowlisting gitignore template for GO projects prevents us
# If you prefer the allow list template instead of the deny list, see community template: # from adding various unwanted local files, such as generated
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore # files, developer configurations or IDE-specific files etc.
# #
# Binaries for programs and plugins # Recommended: Go.AllowList.gitignore
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c` # Ignore everything
*.test *
# Output of the go coverage tool, specifically when used with LiteIDE # But not these files...
*.out !/.gitignore
# Dependency directories (remove the comment below to include it) !*.go
# vendor/ !go.sum
!go.mod
# Go workspace file !examples/*
go.work
bin/ !*.md
!LICENSE
examples/testing/ !Makefile
*.yaml # Woodpecker CI
!examples/*.yaml !.woodpecker/*
test/ # ...even if they are in subdirectories
!*/

4
.vscode/launch.json vendored
View file

@ -9,7 +9,7 @@
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "auto", "mode": "auto",
"program": "${workspaceFolder}", "program": "${workspaceFolder}/cmd/certwarden-deploy/main.go",
"args": ["--config", "${workspaceFolder}/config.yaml", "--dry-run"] "args": ["--config", "${workspaceFolder}/config.yaml", "--dry-run"]
}, },
{ {
@ -17,7 +17,7 @@
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "auto", "mode": "auto",
"program": "${workspaceFolder}", "program": "${workspaceFolder}/cmd/certwarden-deploy/main.go",
"args": ["--config", "${workspaceFolder}/config.yaml", "--verbose"] "args": ["--config", "${workspaceFolder}/config.yaml", "--verbose"]
} }
] ]

13
Makefile Normal file
View file

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

View file

@ -2,7 +2,7 @@
Copyright © 2024 Laura Kalb <dev@lauka.net> 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. The code of this project is available under the MIT license. See the LICENSE file for more info.
*/ */
package cmd package main
import ( import (
"os" "os"
@ -11,9 +11,7 @@ import (
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration" "code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
) )
// Execute adds all child commands to the root command and sets flags appropriately. func main() {
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := cli.RootCmd.Execute() err := cli.RootCmd.Execute()
if err != nil { if err != nil {
os.Exit(1) os.Exit(1)

View file

@ -1,7 +1,9 @@
package constants package constants
const Version = "0.2.1" var Version string
var UserAgent = "certwarden-deploy/" + Version + " +https://code.lila.network/adoralaura/certwarden-deploy"
const CertificateApiPath = "/certwarden/api/v1/download/certificates/" const CertificateApiPath = "/certwarden/api/v1/download/certificates/"
const KeyApiPath = "/certwarden/api/v1/download/privatekeys/" const KeyApiPath = "/certwarden/api/v1/download/privatekeys/"
const ApiKeyHeaderName = "X-API-Key" const ApiKeyHeaderName = "X-API-Key"
const UserAgent = "certwarden-deploy/" + Version + " +https://code.lila.network/adoralaura/certwarden-deploy"

11
main.go
View file

@ -1,11 +0,0 @@
/*
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 cmd "code.lila.network/adoralaura/certwarden-deploy/cmd/certwarden-deploy"
func main() {
cmd.Execute()
}