setup.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. {% macro setup(values) -%}
  2. #!/bin/bash
  3. {%- set cfg_file = "%s/garage.toml" | format(values.consts.config_path) %}
  4. if [ ! -f {{ cfg_file }} ]; then
  5. echo "Creating a new configuration file at {{ cfg_file }}"
  6. touch {{ cfg_file }}
  7. fi
  8. echo "Updating configuration file at {{ cfg_file }}"
  9. {%- set base_cmd = "dasel put --file %s --type" |format(cfg_file) %}
  10. {%- for item in values.garage.additional_options %}
  11. {{ base_cmd }} {{ item.type }} "{{ item.path }}" --value "{{ item.value }}"
  12. {%- endfor %}
  13. {{ base_cmd }} int ".replication_factor" --value 1
  14. {{ base_cmd }} string ".metadata_dir" --value "{{ values.consts.metadata_path }}"
  15. {{ base_cmd }} string ".data_dir" --value "{{ values.consts.data_path }}"
  16. {{ base_cmd }} string ".metadata_snapshots_dir" --value "{{ values.consts.metadata_snapshots_path }}"
  17. {{ base_cmd }} string ".rpc_bind_addr" --value "0.0.0.0:{{ values.network.rpc_port.port_number }}"
  18. {{ base_cmd }} string ".s3_api.api_bind_addr" --value "0.0.0.0:{{ values.network.s3_port.port_number }}"
  19. {{ base_cmd }} string ".s3_api.s3_region" --value "{{ values.garage.region }}"
  20. {{ base_cmd }} string ".s3_web.bind_addr" --value "0.0.0.0:{{ values.network.s3_web_port.port_number }}"
  21. {{ base_cmd }} string ".s3_web.root_domain" --value "{{ values.garage.s3_web_root_domain }}"
  22. {{ base_cmd }} string ".admin.api_bind_addr" --value "0.0.0.0:{{ values.network.admin_port.port_number }}"
  23. echo "Configuration file updated successfully at {{ cfg_file }}"
  24. {% endmacro %}