feat: application.local.yml replaces application.yml#561
Merged
watura merged 4 commits intoNetCommons3:availabilityfrom Dec 26, 2019
WillBooster:wtr/replace-and-merge-application.yml
Merged
feat: application.local.yml replaces application.yml#561watura merged 4 commits intoNetCommons3:availabilityfrom WillBooster:wtr/replace-and-merge-application.yml
watura merged 4 commits intoNetCommons3:availabilityfrom
WillBooster:wtr/replace-and-merge-application.yml
Conversation
Co-Authored-By: Sakamoto, Kazunori <exKAZUu@users.noreply.github.com>
exKAZUu
suggested changes
Dec 20, 2019
exKAZUu
left a comment
There was a problem hiding this comment.
CIでエラーが出ていて、1行は120文字以内でないとだめみたいだよ
30 | ERROR | Line exceeds maximum limit of 120 characters; contains 159
| | characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
やったこと
複数の application.yml系を用意した場合に、application.yml をベースとして、差分があった箇所のみを上書きするようにしました。
現状では、後に読み込まれたymlの内容で、設定全部が上書きされるようになっています。
また、application.yml 系のファイル名として、 httpヘッダーのHost および、X-FORWARDED-HOSTも使うようにしました。
なぜやるか
同じ環境に複数のドメインからアクセスした場合に、fullBaseUrlをアクセス元に合わせて書き換える必要があったため。
Router::fullBaseUrl() で fullBaseUrl は取得できるようなんですが、 application.yml が使われているようなので、application.yml の読み込み周りを変更してみました。
ドメインごとに application.yml と fullBaseUrl だけが違う xxx.yml を用意するよりも、差分がある箇所のみ変更したymlを用意する方がミスが減ると考えたので、差分を読み込んで、更新がある箇所のみ上書きするようにしました。
Host および、X-FORWARDED-HOST
フラット化で、どのapplication.yml を使うかを決めるためHost名を利用するようにしました。
X-FORWARDED-HOST は、CDNからアクセスした場合にセットされるヘッダーになります。
懸念点
eg:
application.yml
application.local.yml
この場合
を読み込んだ場合と同じ内容が、Configure に書き込まれます。