commit 2aefb9639bdf0efcd0b09892c8e6c543e7584992 Author: Captain ALM Date: Mon Jul 11 17:08:50 2022 +0100 Initial commit. diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..55a244b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,8 @@ +kind: pipeline +name: default + +steps: +- name: build + image: golang + commands: + - make build diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2ec00d --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Environment variables file +.env + +# Distributable directory +dist/ + +# Test data and logs folders +.data/ +.idea/dataSources.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/GOPackageHeaderServer.iml b/.idea/GOPackageHeaderServer.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/GOPackageHeaderServer.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..283b9b4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..32bfaca --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..cab63ea --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,11 @@ +Copyright (c) 2022 Captain ALM. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5b362b8 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +SHELL := /bin/bash +BIN := dist/gopkghsrv +ENTRY_POINT := ./cmd/gopkghsrv +HASH := $(shell git rev-parse --short HEAD) +COMMIT_DATE := $(shell git show -s --format=%ci ${HASH}) +BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S') +VERSION := ${HASH} +LD_FLAGS := -s -w -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}' +COMP_BIN := go + +ifeq ($(OS),Windows_NT) + BIN := $(BIN).exe +endif + +.PHONY: build dev test clean + +build: + mkdir -p dist/ + ${COMP_BIN} build -o "${BIN}" -ldflags="${LD_FLAGS}" ${ENTRY_POINT} + +dev: + mkdir -p dist/ + ${COMP_BIN} build -tags debug -o "${BIN}" -ldflags="${LD_FLAGS}" ${ENTRY_POINT} + ./${BIN} + +test: + go test + +clean: + go clean + rm -r -f dist/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c0f819 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# GO Package Header Server + +[![Build Status](https://ci.mrmelon54.xyz/api/badges/alfred/GOPackageHeaderServer/status.svg)](https://ci.mrmelon54.xyz/alfred/GOPackageHeaderServer) + +This allows for the required meta headers to be outputted in order for the GO package system to find the source files of the package. + +The middleware can be configured in runtime, the server has a YAML configuration. + +Maintainer: +[Captain ALM](https://code.mrmelon54.xyz/alfred) + +License: +[BSD 3-Clause](https://code.mrmelon54.xyz/alfred/GOPackageHeaderServer/src/branch/master/LICENSE.md) + +Example configuration: +[config.example.yml](https://code.mrmelon54.xyz/alfred/GOPackageHeaderServer/src/branch/master/config.example.yml) +The configuration must by placed in a .data sub-directory from the executable. A .env file must also be generated (Can be empty). \ No newline at end of file diff --git a/cmd/gopkghsrv/main.go b/cmd/gopkghsrv/main.go new file mode 100644 index 0000000..ad4a711 --- /dev/null +++ b/cmd/gopkghsrv/main.go @@ -0,0 +1,12 @@ +package main + +import "log" + +var ( + buildVersion = "develop" + buildDate = "" +) + +func main() { + log.Printf("[Main] Starting up GO Package Header Server #%s (%s)\n", buildVersion, buildDate) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..dc1c1f0 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module GOPackageHeaderServer + +go 1.18