40 lines
1.3 KiB
Bash
40 lines
1.3 KiB
Bash
#!/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 "./data/config.json" ]; then
|
|
echo "Successfully created './data/config.json'."
|
|
echo "Content of config.json:"
|
|
cat ./data/config.json
|
|
else
|
|
echo "Error: Failed to create './data/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 ---" |