-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathconfig_file.sh
More file actions
executable file
·60 lines (47 loc) · 1.88 KB
/
config_file.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.88 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# This script creates a configuration file for the proof aggregator
# PARAMETERS
#
# TEMPLATE_FILE: Path to the template file
# - SP1: ./infra/aggregation_mode/config-proof-aggregator-sp1.template.yaml
# - Risc0: ./infra/aggregation_mode/config-proof-aggregator-risc0.template.yaml
#
# OUTPUT_FILE: Path to the output file
# - SP1: $HOME/config/config-proof-aggregator-sp1.yaml
# - Risc0: $HOME/config/config-proof-aggregator-risc0.yaml
# Check if template file path is provided as argument
if [ $# -ne 2 ]; then
echo "Usage: $0 <template_file_path> <output_file>"
exit 1
fi
TEMPLATE_FILE="$1"
OUTPUT_FILE="$2"
# Verify template file exists
if [ ! -f "$TEMPLATE_FILE" ]; then
echo "Error: Template file '$TEMPLATE_FILE' not found"
exit 1
fi
# Create temporary file by copying the template
TEMP_FILE=$(mktemp)
cp "$TEMPLATE_FILE" "$TEMP_FILE"
# Function to prompt for input and replace placeholder
prompt_and_replace() {
local placeholder=$1
local description=$2
read -p "Enter $description: " value
sed -i "s|$placeholder|$value|g" "$TEMP_FILE"
}
# Prompt for each placeholder found in the template
prompt_and_replace "<aligned_service_manager_address>" "Aligned Service Manager Address"
prompt_and_replace "<proof_aggregation_service_address>" "Proof Aggregation Service Address"
prompt_and_replace "<eth_rpc_url>" "Ethereum RPC URL"
prompt_and_replace "<eth_ws_url>" "Ethereum WebSocket URL"
prompt_and_replace "<private_key_store_path>" "ECDSA Private Key Store Path (~/.keystores/proof_aggregation.keystore)"
prompt_and_replace "<private_key_store_password>" "ECDSA Private Key Store Password"
# Create destination directory if it doesn't exist
mkdir -p $HOME/config
# Copy the completed file to destination
cp "$TEMP_FILE" "$OUTPUT_FILE"
# Clean up temporary file
rm "$TEMP_FILE"
echo "Configuration file has been created and copied to $OUTPUT_FILE"