Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chisel
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
anun
chisel
Commits
4a00a6c8
Commit
4a00a6c8
authored
Jun 18, 2024
by
anun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove init env
parent
80319e86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
2 deletions
+118
-2
.make-function
+116
-0
server/server.go
+2
-2
No files found.
.make-function
0 → 100644
View file @
4a00a6c8
function hasChanges() {
# old version, just track uncommited + untracked files
# test -n "$(git status -s .)"
# expect 1 to be normal so the untracked file .make-funcition will be ignored
test 0 -ne "$(git status -s . | sed -e '/.make-function/d' | wc -l)"
}
function getRelease() {
# old : use tag in release.conf
# awk -F= '/^RELEASE=/{print $2}' release.conf
# new use tag from git of the form -> 1.0.1-2-3b10c420
TAGN=$(git describe | sed -e "s/-g.*//")
TV=$(echo $TAGN | sed -e "s/-.*//")
TM=$(echo $TAGN | sed -e "s/^[^\-]*//")
if [ -z "$TM" ]
then
TM="-0"
fi
echo $TV$TM
}
function getBaseTag() {
sed -n -e "s/^tag=\(.*\)$(getRelease)\$/\1/p" release.conf
}
function getTag() {
if [ -z "$1" ] ; then
awk -F= '/^tag/{print $2}' release.conf
else
echo "$(getBaseTag)$1"
fi
}
function setRelease() {
if [ -n "$1" ] ; then
sed -i.x -e "s/^tag=.*/tag=$(getTag $1)/" release.conf
sed -i.x -e "s/^RELEASE=.*/RELEASE=$1/g" release.conf
rm -f release.conf.x
runPreTagCommand "$1"
else
echo "ERROR: missing release version parameter " >&2
return 1
fi
}
function runPreTagCommand() {
if [ -n "$1" ] ; then
COMMAND=$(sed -n -e "s/@@RELEASE@@/$1/g" -e 's/^pre_tag_command=\(.*\)/\1/p' release.conf)
if [ -n "$COMMAND" ] ; then
if ! OUTPUT=$(bash -c "$COMMAND" 2>&1) ; then echo $OUTPUT >&2 && exit 1 ; fi
fi
else
echo "ERROR: missing release version parameter " >&2
return 1
fi
}
function tagExists() {
tag=${1:-$(getTag)}
test -n "$tag" && test -n "$(git tag | grep "^$tag\$")"
}
function differsFromRelease() {
tag=$(getTag)
! tagExists $tag || test -n "$(git diff --shortstat -r $tag .)"
}
function getVersion() {
result=$(getRelease)
if hasChanges ; then
result="$result-dirty"
fi
echo $result
}
function getVersionWithHash() {
result=$(getRelease)
if differsFromRelease; then
# output only first 7 characters
# result="$result-$(git log -n 1 --format=%h .)"
# output first 8 characters
result="$result-$(git log -n 1 --format=%H . | head -c 8)"
fi
if hasChanges ; then
result="$result-dirty"
fi
echo $result
}
function nextPatchLevel() {
version=${1:-$(getRelease)}
major_and_minor=$(echo $version | cut -d. -f1,2)
patch=$(echo $version | cut -d. -f3)
version=$(printf "%s.%d" $major_and_minor $(($patch + 1)))
echo $version
}
function nextMinorLevel() {
version=${1:-$(getRelease)}
major=$(echo $version | cut -d. -f1);
minor=$(echo $version | cut -d. -f2);
version=$(printf "%d.%d.0" $major $(($minor + 1))) ;
echo $version
}
function nextMajorLevel() {
version=${1:-$(getRelease)}
major=$(echo $version | cut -d. -f1);
version=$(printf "%d.0.0" $(($major + 1)))
echo $version
}
server/server.go
View file @
4a00a6c8
...
...
@@ -170,7 +170,7 @@ func NewServer(c *Config) (*Server, error) {
//Anun
if
settings
.
InitEnv
()
{
//
if settings.InitEnv() {
/*
dbenable:= settings.EnvBool("DB_ENABLE")
dbuser:= settings.Env("DB_USERNAME")
...
...
@@ -226,7 +226,7 @@ server.Infof("%s", dbDisableTLS)
fmt
.
Fprintf
(
os
.
Stdout
,
"You have connected to the database successfully
\n
"
)
server
.
db
=
db
}
}
//
}
return
server
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment