From f64166fb6ed29042dc3071731e3571cb4fcb8e60 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Thu, 29 Aug 2024 20:21:07 +0900 Subject: [PATCH] Change: HOST -> FINAL_HOST --- backend/app/controllers/api/charts_controller.rb | 2 +- backend/app/controllers/api/discord_controller.rb | 2 +- backend/app/controllers/sonolus/asset_controller.rb | 2 +- backend/app/controllers/sonolus_controller.rb | 2 +- backend/app/models/chart.rb | 4 ++-- config.dev.yml | 2 +- config.prod.yml | 2 +- config.schema.yml | 2 +- config.test.yml | 2 +- frontend/lib/config.server.ts | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/app/controllers/api/charts_controller.rb b/backend/app/controllers/api/charts_controller.rb index c62fb18..0874b13 100644 --- a/backend/app/controllers/api/charts_controller.rb +++ b/backend/app/controllers/api/charts_controller.rb @@ -523,7 +523,7 @@ def update $discord.post( webhook, json: { - content: "#{ENV.fetch("HOST")}/charts/#{chart.name}" + content: "#{ENV.fetch("FINAL_HOST")}/charts/#{chart.name}" } ) end diff --git a/backend/app/controllers/api/discord_controller.rb b/backend/app/controllers/api/discord_controller.rb index 6131d79..f51dee3 100644 --- a/backend/app/controllers/api/discord_controller.rb +++ b/backend/app/controllers/api/discord_controller.rb @@ -7,7 +7,7 @@ class DiscordController < FrontendController def redirect_uri "#{ ENV.fetch( - "HOST", + "FINAL_HOST", "#{Rails.env.development? ? "http://" : "https://"}#{request.host_with_port}" ) }/api/discord/callback" diff --git a/backend/app/controllers/sonolus/asset_controller.rb b/backend/app/controllers/sonolus/asset_controller.rb index 0639634..2085b7f 100644 --- a/backend/app/controllers/sonolus/asset_controller.rb +++ b/backend/app/controllers/sonolus/asset_controller.rb @@ -219,7 +219,7 @@ def self.asset_get(type, name) end [k, v] end - .merge({ source: ENV.fetch("HOST", nil), tags: [] }) + .merge({ source: ENV.fetch("FINAL_HOST", nil), tags: [] }) end end end diff --git a/backend/app/controllers/sonolus_controller.rb b/backend/app/controllers/sonolus_controller.rb index 37aa345..3e2da2a 100644 --- a/backend/app/controllers/sonolus_controller.rb +++ b/backend/app/controllers/sonolus_controller.rb @@ -279,7 +279,7 @@ def authenticate render json: { error: "Invalid type" }, status: :unauthorized return end - if params[:address].exclude?(ENV["HOST"]) + if params[:address].exclude?(ENV["FINAL_HOST"]) logger.warn "Invalid address" render json: { error: "Invalid address" }, status: :unauthorized return diff --git a/backend/app/models/chart.rb b/backend/app/models/chart.rb index 4ff61a2..418f1e2 100644 --- a/backend/app/models/chart.rb +++ b/backend/app/models/chart.rb @@ -102,7 +102,7 @@ def to_sonolus title:, artists: "#{composer} / #{artist.presence || "-"}", author: "#{author_name.presence || author.name}##{author.display_handle}", - source: ENV.fetch("HOST", nil), + source: ENV.fetch("FINAL_HOST", nil), tags: [ { title: likes_count.to_s, icon: "heart" }, ( @@ -167,7 +167,7 @@ def to_sonolus_background(resources, version: 3) name: "chcy-bg-#{name}-v#{version}", version: 2, tags: [], - source: ENV.fetch("HOST", nil), + source: ENV.fetch("FINAL_HOST", nil), title: I18n.t("sonolus.backgrounds.title", name: title, version:), subtitle: "#{composer}#{artist.presence ? " / #{artist}" : ""}", author: "#{author_name.presence || author.name}##{author.display_handle}", diff --git a/config.dev.yml b/config.dev.yml index d78dc34..75f1573 100644 --- a/config.dev.yml +++ b/config.dev.yml @@ -2,7 +2,7 @@ # Configuration template for development environment. admin_handle: "1073" -host: "http://192.168.1.2:3000" +final_host: "http://192.168.1.2:3000" # rake secret to generate a new secret key base. secret_key_base: "" hosts: diff --git a/config.prod.yml b/config.prod.yml index f476fae..8462023 100644 --- a/config.prod.yml +++ b/config.prod.yml @@ -3,7 +3,7 @@ admin_handle: "1073" final_port: 8080 -host: "https://example.com" +final_host: "https://example.com" # rake secret to generate a new secret key base. secret_key_base: "" hosts: diff --git a/config.schema.yml b/config.schema.yml index 0439903..e08a522 100644 --- a/config.schema.yml +++ b/config.schema.yml @@ -6,7 +6,7 @@ properties: admin_handle: type: "string" description: "Your Sonolus handle." - host: + final_host: type: "string" description: "The host that the chart cyanvas will be hosted on." final_port: diff --git a/config.test.yml b/config.test.yml index 8f6c5e2..7aa5481 100644 --- a/config.test.yml +++ b/config.test.yml @@ -2,7 +2,7 @@ # Configuration template for development environment. admin_handle: "1073" -host: "http://192.168.1.2:3000" +final_host: "http://192.168.1.2:3000" secret_key_base: "af8a3d82ff17801024fe1a8a11b552ac501eb4a0acdf14e4bb7c81d16e7130446bd20a907721ad42741196a5cc1e07ffb2017bd3731a9a12d92c40137fca527c" hosts: backend: "http://localhost:3000" diff --git a/frontend/lib/config.server.ts b/frontend/lib/config.server.ts index ffb0acf..8f11e0f 100644 --- a/frontend/lib/config.server.ts +++ b/frontend/lib/config.server.ts @@ -1,3 +1,3 @@ -export const host = process.env.HOST!; +export const host = process.env.FINAL_HOST!; export const backendUrl = process.env.HOSTS_BACKEND!; export const discordEnabled = !!process.env.DISCORD_BOT_TOKEN;