Skip to content

Commit

Permalink
work on config gen
Browse files Browse the repository at this point in the history
  • Loading branch information
UplandJacob2 authored Nov 10, 2024
1 parent ab45587 commit 0de95ee
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mc-all-platform-velocity/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
logGreen() {
echo -e "\033[32m$1\033[0m"
}

echo ""
echo ""
#-------- get config ------------
VEL_ROOT_CONFIG=$(bashio::config 'rootConfig')
VEL_SERVERS=$(bashio::config 'servers')
VEL_SERV_ATT_JOIN_ORD=$(bashio::config 'serverAttemptJoinOrder')
echo $VEL_SERV_ATT_JOIN_ORD
# main section
vel_root_config=$(echo "$VEL_ROOT_CONFIG" | jq -r 'to_entries | .[] | "\(.key) = \(.value)"')
# '[servers]' section
echo ""
echo $VEL_SERVERS
vel_servers_JSON=$(echo $VEL_SERVERS | sed 's/}/},/g' | sed '$ s/,$//' | awk '{print "[" $0 "]"}')
echo $vel_servers_JSON
Expand All @@ -19,13 +22,15 @@ vel_servers_length=$(echo "$vel_servers_JSON" | jq '. | length')
for (( i=0; i<$vel_servers_length; i++ )); do
name=$(echo "$vel_servers_JSON" | jq -r ".[$i].name")
addr=$(echo "$vel_servers_JSON" | jq -r ".[$i].address")
vel_servers+="$name = address=$addr\n"
vel_servers+="$name = \"$addr\"\n"
vel_servers+="\n"
done
echo $vel_servers


echo -e "config-version = \"2.7\"\nbind = \"0.0.0.0:25565\"\n$vel_root_config\n[servers]\n$vel_servers" > velocity.toml


echo -e "config-version = \"2.7\"\nbind = \"0.0.0.0:25565\"\n$vel_root_config\n[servers]\n$vel_servers\n\ntry = [\n" > velocity.toml
logGreen "velocity.toml:"
cat velocity.toml

Expand Down

0 comments on commit 0de95ee

Please sign in to comment.