From ec644490be6b72894b61ef80160f5be36380ce7b Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 30 Mar 2025 04:04:27 -0600 Subject: [PATCH] refactor: convert template.yml files to template.toml format - Updated the script to convert 'template.yml' files to 'template.toml' files during directory processing. - Added new 'template.toml' files for Backrest and BlinkO blueprints with appropriate configuration settings. --- app/script.js | 8 ++++++-- blueprints/backrest/template.toml | 11 +++++++++++ blueprints/blinko/template.toml | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 blueprints/backrest/template.toml create mode 100644 blueprints/blinko/template.toml diff --git a/app/script.js b/app/script.js index 87ed39b..fd64000 100644 --- a/app/script.js +++ b/app/script.js @@ -22,11 +22,15 @@ function processDirectory(dirPath) { if (stat.isDirectory()) { processDirectory(filePath); } else if (file === "template.yml") { - console.log(`Deleting ${filePath}`); - fs.unlinkSync(filePath); + console.log(`Converting ${filePath}`); + const yamlContent = fs.readFileSync(filePath, "utf8"); + const tomlContent = convertYamlToToml(yamlContent); + const tomlPath = path.join(dirPath, "template.toml"); + fs.writeFileSync(tomlPath, tomlContent); } }); } +// Ruta al directorio blueprints relativa al script const blueprintsPath = path.join(__dirname, "..", "blueprints"); processDirectory(blueprintsPath); diff --git a/blueprints/backrest/template.toml b/blueprints/backrest/template.toml new file mode 100644 index 0000000..7e42678 --- /dev/null +++ b/blueprints/backrest/template.toml @@ -0,0 +1,11 @@ +[variables] +main_domain = "${domain}" + +[config] +env = ["TZ=Europe/Paris"] +mounts = [] + +[[config.domains]] +serviceName = "backrest" +port = 9_898 +host = "${main_domain}" diff --git a/blueprints/blinko/template.toml b/blueprints/blinko/template.toml new file mode 100644 index 0000000..127e39b --- /dev/null +++ b/blueprints/blinko/template.toml @@ -0,0 +1,20 @@ +[variables] +main_domain = "${domain}" +postgres_password = "${password:16}" +nextauth_secret = "${password:32}" +nextauth_url = "http://${main_domain}" +next_public_base_url = "http://${main_domain}" + +[config] +env = [ + "nextauth_secret=${nextauth_secret}", + "postgres_password=${postgres_password}", + "nextauth_url=${nextauth_url}", + "next_public_base_url=${next_public_base_url}", +] +mounts = [] + +[[config.domains]] +serviceName = "blinko-website" +port = 1_111 +host = "${main_domain}"