Files
status-benchmarks/docker-utils/status-init/init_container.py
Alberto Soutullo a92c7cde89 Second benchmark additions (#32)
* Change controlbox pull to Always

* Update status-init to fix discovery issues.

* Improve logging in inject_messages_group_chat

* Save messages in a list with timestamps

* Add method for cleanup signals on logout (probably to avoid issues when loging in and searching for signals)

* Save last loging time
2025-09-29 19:29:38 +02:00

64 lines
1.6 KiB
Python

import json
import os
import sys
import logging
from pathlib import Path
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def update_config():
bootstrap_enrs = [
os.getenv(env)
for env in os.environ
if env.startswith("BOOT_ENRS") and os.getenv(env).startswith("enr:")
]
store_enrs = [
os.getenv(env)
for env in os.environ
if env.startswith("STORE_ENRS") and os.getenv(env).startswith("enr:")
]
config_path = os.getenv("CONFIG_PATH", "/static/configs/config.json")
try:
config_dir = Path(config_path).parent
config_dir.mkdir(parents=True, exist_ok=True)
logger.info(f"Ensured config folder exists at: {config_dir}")
config = {
"dst.dev": {
"wakuNodes": bootstrap_enrs, # --staticnode
"discV5BootstrapNodes": bootstrap_enrs, # --discv5-bootstrap-node
"clusterId": int(os.getenv("CLUSTER_ID", 16)),
"storeNodes": []
}
}
for counter, enr in enumerate(store_enrs):
config["dst.dev"]["storeNodes"].append({
"id": f"store-node-{counter}",
"enr": enr,
"addr": "",
"fleet": "dst.dev"
})
with open(config_path, "w") as f:
json.dump(config, f, indent=2)
logger.info(f"Configuration successfully written to {config_path}")
except Exception as e:
logger.error(f"Failed to update config: {e}", exc_info=True)
sys.exit(1)
def main():
update_config()
if __name__ == "__main__":
main()