init install.sh
This commit is contained in:
40
install.sh
Normal file
40
install.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script creates a config.json file with predefined settings.
|
||||||
|
# You can extend this script to include other installation requirements,
|
||||||
|
# such as installing dependencies or setting up your environment.
|
||||||
|
|
||||||
|
create_config_json() {
|
||||||
|
echo "Creating config.json file..."
|
||||||
|
|
||||||
|
# Define the JSON content directly as a multi-line string
|
||||||
|
local config_content='{
|
||||||
|
"SERVER_WS_URI": "ws://drb-sock.vpn.cusano.net",
|
||||||
|
"SERVER_API_URL": "https://drb-api.vpn.cusano.net",
|
||||||
|
"CLIENT_API_URL": "http://localhost:8001",
|
||||||
|
"nickname": ""
|
||||||
|
}'
|
||||||
|
|
||||||
|
# Create the data dir
|
||||||
|
mkdir -p ./data/
|
||||||
|
|
||||||
|
# Write the content to config.json
|
||||||
|
# The 'echo' command with a multi-line string is used to write the content.
|
||||||
|
echo "$config_content" > ./data/config.json
|
||||||
|
|
||||||
|
# Check if the file was successfully created
|
||||||
|
if [ -f "config.json" ]; then
|
||||||
|
echo "Successfully created 'config.json'."
|
||||||
|
echo "Content of config.json:"
|
||||||
|
cat config.json
|
||||||
|
else
|
||||||
|
echo "Error: Failed to create 'config.json'."
|
||||||
|
exit 1 # Exit with an error code if file creation fails
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call the function to create the config.json file
|
||||||
|
create_config_json
|
||||||
|
echo "--- Config Created ---"
|
||||||
|
|
||||||
|
echo "--- Script finished ---"
|
||||||
Reference in New Issue
Block a user