Last active
May 18, 2020 01:51
-
-
Save satour/ec03f731ad9a9ce0041ac1351d0ce1d0 to your computer and use it in GitHub Desktop.
This file contains 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
#全体的な設定です。 | |
[Settings] | |
ID = "Your_Site_ID" | |
#ビルドに関する設定。アプリ全体に反映されます。 | |
[build] | |
# base: ビルドを開始する場所です。package.json や .nvmrc などがここに配置されている必要があります。あなたのプロジェクトのルートディレクトリをここに指定するというわけではありません。 | |
base = "project/" | |
# publish: 公開対象のディレクトリ | |
publish = "project/build-output/" | |
# command: デフォルトのビルドコマンド | |
command = "echo 'default context'" | |
# functions: ファンクションの配置場所 | |
functions = "project/functions/" | |
# プロダクションコンテクスト: すべての production ブランチからのデプロイは、この設定を継承します。 | |
[context.production] | |
publish = "output/" | |
command = "make publish" | |
environment = { ACCESS_TOKEN = "super secret", NODE_ENV = "8.0.1" } | |
# デプロイプレビューコンテクスト: すべてのデプロイプレビューは、この設定を継承します。 | |
[context.deploy-preview] | |
publish = "dist/" | |
# デプロイプレビューコンテクストのなかで、さらに個別の環境に環境変数を設定したい場合は、このように記述します。 | |
[context.deploy-preview.environment] | |
ACCESS_TOKEN = "not so secret" | |
# ブランチデプロイプコンテクスト: ブランチデプロイを設定している場合、すべてのプランチデプロイはこの設定を継承します。 | |
[context.branch-deploy] | |
command = "echo branch" | |
[context.branch-deploy.environment] | |
NODE_ENV = "development" | |
# 個別ブランチコンテクスト: ブランチデプロイを設定している場合、個別ののブランチに設定はこのようにおこないます。個別ブランチコンテクストはブランチデプロイコンテクストを上書きします。 | |
[context.staging] # 'staging' はブランチ名です。 | |
command = "echo 'staging'" | |
base = "staging" | |
# ブランチ名が特殊文字を含む場合、ダブルクォートでエスケープしてください。 | |
[context."feat/branch"] | |
command = "echo 'special branch'" | |
base = "branch" | |
# Note that all redirects and headers are GLOBAL for all builds: | |
# they do not get scoped to contexts no matter where you enter them in the file | |
# For context-specific rules, use _headers or _redirects - those are PER-DEPLOY. | |
# A basic redirects rule | |
[[redirects]] | |
from = "/*" | |
to = "/blog/:splat" | |
# The following show an example redirects rule with all the supported properties. | |
[[redirects]] | |
from = "/old-path" | |
to = "/new-path" | |
status = 301 | |
force = false | |
query = {path = ":path"} # apply this rule for /old-path?path=example | |
# NOTE: Each combination of query params will need to be defined in a separate [[redirects]] block. More here: https://www.netlify.com/docs/redirects/#query-params | |
conditions = {Language = ["en"], Country = ["US"], Role = ["admin"]} | |
# you can use env variables you've set in the UI or within your contexts as values | |
# sign each request with the value of this env variable | |
signed = "API_SIGNATURE_TOKEN" | |
# NOTE: env variables are only natively supported for this signed property of headers via this mechanism! | |
# You can also define custom headers within your redirects blocks | |
[redirects.headers] | |
X-From = "Netlify" | |
X-Api-Key = "some-api-key-string" | |
# The following redirect is intended for use with most SPA's that handles routing internally. | |
[[redirects]] | |
from = "/*" | |
to = "/index.html" | |
status = 200 | |
[[headers]] | |
for = "/*" # This defines which paths this specific [[headers]] block will cover. | |
[headers.values] | |
X-Frame-Options = "DENY" | |
X-XSS-Protection = "1; mode=block" | |
Content-Security-Policy = "frame-ancestors https://www.facebook.com" | |
# Multi-key header rules are expressed with multi-line strings | |
Link = ''' | |
</assets/css/base.css>; rel=preload; as=style, \ | |
</assets/css/base2.css>; rel=preload; as=style, \ | |
</assets/css/base3.css>; rel=preload; as=style''' | |
# Basic-Auth allows you to password protect your whole site but is only available | |
# to paid accounts | |
Basic-Auth = "someuser:somepassword anotheruser:anotherpassword" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment