105 lines
3.1 KiB
Ruby
105 lines
3.1 KiB
Ruby
class Krakend < Formula
|
|
desc "Ultra-High performance API Gateway built in Go"
|
|
homepage "https://www.krakend.io/"
|
|
url "https://github.com/devopsfaith/krakend-ce/archive/v1.2.0.tar.gz"
|
|
sha256 "81203b45d25fd76781c7e344571eca3c8714b52d22759b5eed74cbe7f769001b"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "42a7b1b931569c4471d5709dacb6f3ccf8a597090641df5af3cb550eaa58b0d6" => :big_sur
|
|
sha256 "8fd55d4d43cf4d9294ada079435fe6e33c6e6544497bce5f518b450cb7516e08" => :catalina
|
|
sha256 "8ed61a823f052964f202e2d0c9e782de02b1f42dc156cadd111f1dc0a9d2824e" => :mojave
|
|
sha256 "70fde3f0d25235a1c53a094b7b180074996912eb76490bb989dd9a6106d8c1da" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
(buildpath/"src/github.com/devopsfaith/krakend-ce").install buildpath.children
|
|
cd "src/github.com/devopsfaith/krakend-ce" do
|
|
system "make", "build"
|
|
bin.install "krakend"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"krakend_unsupported_version.json").write <<~EOS
|
|
{
|
|
"version": 1,
|
|
"extra_config": {
|
|
"github_com/devopsfaith/krakend-gologging": {
|
|
"level": "WARNING",
|
|
"prefix": "[KRAKEND]",
|
|
"syslog": false,
|
|
"stdout": true
|
|
}
|
|
}
|
|
}
|
|
EOS
|
|
assert_match "Unsupported version",
|
|
shell_output("#{bin}/krakend check -c krakend_unsupported_version.json 2>&1", 1)
|
|
|
|
(testpath/"krakend_bad_file.json").write <<~EOS
|
|
{
|
|
"version": 2,
|
|
"bad": file
|
|
}
|
|
EOS
|
|
assert_match "ERROR",
|
|
shell_output("#{bin}/krakend check -c krakend_bad_file.json 2>&1", 1)
|
|
|
|
(testpath/"krakend.json").write <<~EOS
|
|
{
|
|
"version": 2,
|
|
"extra_config": {
|
|
"github_com/devopsfaith/krakend-gologging": {
|
|
"level": "WARNING",
|
|
"prefix": "[KRAKEND]",
|
|
"syslog": false,
|
|
"stdout": true
|
|
}
|
|
},
|
|
"endpoints": [
|
|
{
|
|
"endpoint": "/test",
|
|
"method": "GET",
|
|
"concurrent_calls": 1,
|
|
"extra_config": {
|
|
"github_com/devopsfaith/krakend-httpsecure": {
|
|
"disable": true,
|
|
"allowed_hosts": [],
|
|
"ssl_proxy_headers": {}
|
|
},
|
|
"github.com/devopsfaith/krakend-ratelimit/juju/router": {
|
|
"maxRate": 0,
|
|
"clientMaxRate": 0
|
|
}
|
|
},
|
|
"backend": [
|
|
{
|
|
"url_pattern": "/backend",
|
|
"extra_config": {
|
|
"github.com/devopsfaith/krakend-oauth2-clientcredentials": {
|
|
"is_disabled": true,
|
|
"endpoint_params": {}
|
|
}
|
|
},
|
|
"encoding": "json",
|
|
"sd": "dns",
|
|
"host": [
|
|
"host1"
|
|
],
|
|
"disable_host_sanitize": true
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
EOS
|
|
assert_match "OK",
|
|
shell_output("#{bin}/krakend check -c krakend.json 2>&1")
|
|
end
|
|
end
|