forked from gitblit-org/gitblit-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
executable file
·36 lines (29 loc) · 1.41 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Create the gitblit_properties dictionary in declare_properties_dictionary.sh
source declare_properties_dictionary.sh
GITBLIT_PROPERTIES_FILE=/opt/gitblit-data/gitblit.properties
function set_gitblit_property {
local env_var_name=$1
# check env in dictionary
if [ "${gitblit_properties[$env_var_name]}" ]; then
local env_var_value=${!env_var_name}
local gitblit_property=${gitblit_properties[$env_var_name]}
echo "Found '$env_var_name' do setting property '$gitblit_property' to value '${env_var_value} in file $GITBLIT_PROPERTIES_FILE"
if [ "$(grep "${gitblit_property}=${env_var_value}" $GITBLIT_PROPERTIES_FILE | wc -l)" -eq "0" ]; then
if [ "$(grep "${gitblit_property}" $GITBLIT_PROPERTIES_FILE | wc -l)" -ne "0" ]; then
gitblit_property_search=${gitblit_property/\./\\\.}
sed -i /$gitblit_property_search/d $GITBLIT_PROPERTIES_FILE
fi
echo "${gitblit_property}=${env_var_value}" >> $GITBLIT_PROPERTIES_FILE
fi
else
echo "No property exists with name $env_var_name"
fi
}
echo "Finding GITBLIT_* env vars and setting them as properties"
# Get the env vars and pass to set_gitblit_property to process
for env_var in $(env | grep "^GITBLIT_" | cut -d= -f1); do
set_gitblit_property $env_var
done
echo "Running Gitblit server... "
java -server -Xmx1024M -Djava.awt.headless=true -jar /opt/gitblit/gitblit.jar --baseFolder /opt/gitblit-data