You've already forked go-template-container-webserver
Compare commits
4 Commits
02db176da9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 068b543bdd | |||
| c3bac048fc | |||
| c2a3806e8e | |||
| 7a341570f6 |
@@ -25,7 +25,7 @@ jobs:
|
|||||||
git config --global user.email "${GIT_EMAIL}"
|
git config --global user.email "${GIT_EMAIL}"
|
||||||
git config --global credential.helper store
|
git config --global credential.helper store
|
||||||
echo "https://${GIT_EMAIL//@/%40}:${GIT_TOKEN}@git.bjphoster.com" > ~/.git-credentials
|
echo "https://${GIT_EMAIL//@/%40}:${GIT_TOKEN}@git.bjphoster.com" > ~/.git-credentials
|
||||||
./update_child_repos.sh
|
./update_child_repos.sh "${{ github.event.before }}"
|
||||||
env:
|
env:
|
||||||
GIT_NAME: ${{ secrets.GIT_NAME }}
|
GIT_NAME: ${{ secrets.GIT_NAME }}
|
||||||
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
|
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
|
||||||
|
|||||||
3
makefile
3
makefile
@@ -30,6 +30,9 @@ dockerpush:
|
|||||||
deploy:
|
deploy:
|
||||||
bash -c "./deploy.sh"
|
bash -c "./deploy.sh"
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test ./...
|
||||||
|
|
||||||
version:
|
version:
|
||||||
bash -c "./version.sh"
|
bash -c "./version.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,23 @@ func (s *WebServer) Initialize() {
|
|||||||
}
|
}
|
||||||
s.AppName = "Go Template Container Web Server"
|
s.AppName = "Go Template Container Web Server"
|
||||||
|
|
||||||
// Attempt to read the config file
|
// Attempt to read the config file (try both config.yml and config.yaml)
|
||||||
|
var configFile []byte
|
||||||
|
var configPath string
|
||||||
|
|
||||||
configFile, err := os.ReadFile("config.yml")
|
configFile, err := os.ReadFile("config.yml")
|
||||||
|
if err == nil {
|
||||||
|
configPath = "config.yml"
|
||||||
|
} else {
|
||||||
|
configFile, err = os.ReadFile("config.yaml")
|
||||||
|
if err == nil {
|
||||||
|
configPath = "config.yaml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// File does not exist, log and use default config
|
// Neither file exists, log and use default config
|
||||||
fmt.Println("Config file not found, using default settings.")
|
fmt.Println("Config file not found, using default settings.")
|
||||||
} else {
|
} else {
|
||||||
// Some other error occurred when trying to read the file, exit
|
// Some other error occurred when trying to read the file, exit
|
||||||
@@ -43,7 +55,7 @@ func (s *WebServer) Initialize() {
|
|||||||
// If the file exists, unmarshal it into the ServiceSettings struct
|
// If the file exists, unmarshal it into the ServiceSettings struct
|
||||||
err = yaml.Unmarshal(configFile, &s)
|
err = yaml.Unmarshal(configFile, &s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error parsing config file:", err)
|
fmt.Println("Error parsing config file:", configPath, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ TEMPLATE_BRANCH="main"
|
|||||||
CURRENT_COMMIT_ID=$(git rev-parse HEAD)
|
CURRENT_COMMIT_ID=$(git rev-parse HEAD)
|
||||||
COMMIT_MESSAGE="Template updates (commit: ${CURRENT_COMMIT_ID:0:7})"
|
COMMIT_MESSAGE="Template updates (commit: ${CURRENT_COMMIT_ID:0:7})"
|
||||||
|
|
||||||
PREVIOUS_COMMIT_ID=$(git log --format="%H" -n 2 HEAD | tail -n 1)
|
PREVIOUS_COMMIT_ID="${1:-}"
|
||||||
|
|
||||||
|
if [ -z "${PREVIOUS_COMMIT_ID}" ]; then
|
||||||
|
PREVIOUS_COMMIT_ID=$(git log --format="%H" -n 2 HEAD | tail -n 1)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${PREVIOUS_COMMIT_ID}" = "${CURRENT_COMMIT_ID}" ]; then
|
if [ "${PREVIOUS_COMMIT_ID}" = "${CURRENT_COMMIT_ID}" ]; then
|
||||||
FILES_CHANGED=""
|
FILES_CHANGED=""
|
||||||
|
|||||||
14
version.sh
14
version.sh
@@ -1,18 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Get version from user
|
if [ -z ${APP_VERSION} ]; then
|
||||||
read -p "Version [latest]: " VERSIONINPUT
|
read -p "Version [latest]: " VERSIONINPUT
|
||||||
# If version was not provided, use the latest commit short hash as version
|
if [ -z ${VERSIONINPUT} ]; then
|
||||||
if [ -z ${VERSIONINPUT} ]; then
|
|
||||||
APP_VERSION="latest"
|
APP_VERSION="latest"
|
||||||
else
|
else
|
||||||
APP_VERSION=${VERSIONINPUT}
|
APP_VERSION=${VERSIONINPUT}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get docker push option from user
|
# Get docker push option from user
|
||||||
read -p "Docker push? [n]: " DOCKERPUSH
|
|
||||||
if [ -z ${DOCKERPUSH} ]; then
|
if [ -z ${DOCKERPUSH} ]; then
|
||||||
|
read -p "Docker push? [n]: " DOCKERPUSH
|
||||||
|
if [ -z ${DOCKERPUSH} ]; then
|
||||||
DOCKERPUSH=n
|
DOCKERPUSH=n
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create version tag (if provided)
|
# Create version tag (if provided)
|
||||||
|
|||||||
Reference in New Issue
Block a user