Skip to content

Commit

Permalink
Add support for Caddyfile (#6862)
Browse files Browse the repository at this point in the history
add support for Caddyfile
  • Loading branch information
willnorris committed Jun 7, 2024
1 parent 117012a commit 1149d0f
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,9 @@
[submodule "vendor/grammars/vscode-brightscript-language"]
path = vendor/grammars/vscode-brightscript-language
url = https://github.com/rokucommunity/vscode-brightscript-language.git
[submodule "vendor/grammars/vscode-caddyfile"]
path = vendor/grammars/vscode-caddyfile
url = https://github.com/caddyserver/vscode-caddyfile.git
[submodule "vendor/grammars/vscode-cadence"]
path = vendor/grammars/vscode-cadence
url = https://github.com/onflow/vscode-cadence.git
Expand Down
4 changes: 4 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,10 @@ vendor/grammars/vscode-bitbake:
- source.bb
vendor/grammars/vscode-brightscript-language:
- source.brs
vendor/grammars/vscode-caddyfile:
- source.Caddyfile
- source.Caddyfile-test
- source.markdown.caddy.codeblock
vendor/grammars/vscode-cadence:
- markdown.cadence.codeblock
- source.cadence
Expand Down
12 changes: 12 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,18 @@ Cabal Config:
codemirror_mime_type: text/x-haskell
tm_scope: source.cabal
language_id: 677095381
Caddyfile:
type: data
color: "#22b638"
aliases:
- Caddy
extensions:
- ".caddyfile"
filenames:
- Caddyfile
ace_mode: text
tm_scope: source.Caddyfile
language_id: 615465151
Cadence:
type: programming
color: "#00ef8b"
Expand Down
27 changes: 27 additions & 0 deletions samples/Caddyfile/acmeserver.Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
pki {
ca internal {
name "Internal"
root_cn "Internal Root Cert"
intermediate_cn "Internal Intermediate Cert"
}
ca internal-long-lived {
name "Long-lived"
root_cn "Internal Root Cert 2"
intermediate_cn "Internal Intermediate Cert 2"
}
}
}

acme-internal.example.com {
acme_server {
ca internal
}
}

acme-long-lived.example.com {
acme_server {
ca internal-long-lived
lifetime 7d
}
}
63 changes: 63 additions & 0 deletions samples/Caddyfile/reverseproxy.caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
:8884

reverse_proxy 127.0.0.1:65535 {
@500 status 500
replace_status @500 400

@all status 2xx 3xx 4xx 5xx
replace_status @all {http.error.status_code}

replace_status {http.error.status_code}

@accel header X-Accel-Redirect *
handle_response @accel {
respond "Header X-Accel-Redirect!"
}

@another {
header X-Another *
}
handle_response @another {
respond "Header X-Another!"
}

@401 status 401
handle_response @401 {
respond "Status 401!"
}

handle_response {
respond "Any! This should be last in the JSON!"
}

@403 {
status 403
}
handle_response @403 {
respond "Status 403!"
}

@multi {
status 401 403
status 404
header Foo *
header Bar *
}
handle_response @multi {
respond "Headers Foo, Bar AND statuses 401, 403 and 404!"
}

@200 status 200
handle_response @200 {
copy_response_headers {
include Foo Bar
}
respond "Copied headers from the response"
}

@201 status 201
handle_response @201 {
header Foo "Copying the response"
copy_response 404
}
}
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **CSS:** [tree-sitter/tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css) 🐌
- **CUE:** [cue-sh/vscode-cue](https://github.com/cue-sh/vscode-cue)
- **Cabal Config:** [atom-haskell/language-haskell](https://github.com/atom-haskell/language-haskell)
- **Caddyfile:** [caddyserver/vscode-caddyfile](https://github.com/caddyserver/vscode-caddyfile)
- **Cadence:** [onflow/vscode-cadence](https://github.com/onflow/vscode-cadence)
- **Cairo:** [xshitaka/atom-language-cairo](https://github.com/xshitaka/atom-language-cairo)
- **CameLIGO:** [pewulfman/Ligo-grammar](https://github.com/pewulfman/Ligo-grammar)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/vscode-caddyfile
Submodule vscode-caddyfile added at 7e25ac
31 changes: 31 additions & 0 deletions vendor/licenses/git_submodule/vscode-caddyfile.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: vscode-caddyfile
version: 7e25ac572eaf74ac916eeb2f3dc3ba2ac9faf042
type: git_submodule
homepage: https://github.com/caddyserver/vscode-caddyfile.git
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright (c) 2023 Matthew Penner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

0 comments on commit 1149d0f

Please sign in to comment.