From 99804336ea2054c09802e2c0a5d83083bb43d4a8 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Tue, 21 Aug 2018 09:08:51 +0200 Subject: [PATCH] Initial import --- .gitignore | 2 ++ Dockerfile | 9 +++++++++ Makefile | 27 +++++++++++++++++++++++++++ test.sh | 17 +++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100755 test.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..adc7657 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_*test.sh +trello2mail diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f0ddfbb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.10 AS build +COPY . /go/src/github.com/glenux/trello2mail-go +WORKDIR /go/src/github.com/glenux/trello2mail-go +RUN CGO_ENABLED=0 go build -o trello2mail main.go + +FROM alpine:3.7 +RUN apk add --no-cache ca-certificates +COPY --from=build /go/src/github.com/glenux/trello2mail-go/ /usr/bin/trello2mail +CMD ["./main"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ff82f57 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ + +GOFILES=$(wildcard *.go) +NAME=trello2mail + +all: build + +.PHONY: build +build: ## build executable + go build ./... + +install: ## install binaries + go install ./... + +.PHONY: shellcheck +shellcheck: ## run shellcheck validation + scripts/validate/shellcheck + +.PHONY: help +help: ## print this help + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + +.PHONY: clean +clean: ## remove build artifacts + rm -rf ./_build/* + +test: build + ./test.sh diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..01da3d2 --- /dev/null +++ b/test.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +export EMAIL_FROM="admin@example.com" +export EMAIL_TO="admin@example.com" +export EMAIL_SUBJECT="Daily trello mail" + +export TRELLO_URL="https://trello.com/b/someId/someName" +export TRELLO_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + +export SMTP_USERNAME="admin" +export SMTP_PASSWORD="admin" +export SMTP_PORT="465" +export SMTP_HOSTNAME="mail.example.com" +export SMTP_USE_AUTH="true" +export SMTP_USE_SSL="true" + +./_build/trello2mail