Compare commits

...

12 Commits

Author SHA1 Message Date
15965c5b5f Bump version (v0.15.0)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2020-11-24 19:34:20 +01:00
1eade03b63 Load env in docker-compose setup
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:33:12 +01:00
f41fbc8baf Fix test
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:24:35 +01:00
14cd21dc1c Make paths consistent
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:13:08 +01:00
1bdee4ee36 Document new config mechanism
All checks were successful
continuous-integration/drone/push Build is passing
2020-11-24 19:07:21 +01:00
9e33742d81 Use new config 2020-11-24 19:06:49 +01:00
8e78d13443 Make full base URL configurable 2020-11-24 19:06:42 +01:00
391fa39470 Use config and dotenv over structopt 2020-11-24 19:06:18 +01:00
e6e90214e2 Add example configurations 2020-11-24 19:05:56 +01:00
6f734b103a Ignore actual configs 2020-11-24 19:05:46 +01:00
413bb824e1 Merge pull request #198 from vbrandl/dependabot/cargo/tracing-0.1.22
All checks were successful
continuous-integration/drone/push Build is passing
Bump tracing from 0.1.21 to 0.1.22
2020-11-24 18:22:29 +01:00
58ad13dbad Bump tracing from 0.1.21 to 0.1.22
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.21 to 0.1.22.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.21...tracing-0.1.22)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-24 04:17:21 +00:00
15 changed files with 243 additions and 227 deletions

7
.env.example Normal file
View File

@ -0,0 +1,7 @@
HOC_REPODIR='./repos'
HOC_CACHEDIR='./cache'
HOC_PORT=8080
HOC_HOST='0.0.0.0'
HOC_WORKERS=4
HOC_BASE_URL='http://0.0.0.0:8080'

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ repos
cache cache
hoc.log hoc.log
result result
hoc.toml
.env

311
Cargo.lock generated
View File

@ -95,7 +95,7 @@ dependencies = [
"pin-project 1.0.1", "pin-project 1.0.1",
"rand", "rand",
"regex", "regex",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
"serde_urlencoded 0.6.1", "serde_urlencoded 0.6.1",
"sha-1", "sha-1",
@ -123,7 +123,7 @@ dependencies = [
"http", "http",
"log", "log",
"regex", "regex",
"serde", "serde 1.0.117",
] ]
[[package]] [[package]]
@ -280,7 +280,7 @@ dependencies = [
"mime", "mime",
"pin-project 1.0.1", "pin-project 1.0.1",
"regex", "regex",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
"serde_urlencoded 0.6.1", "serde_urlencoded 0.6.1",
"socket2", "socket2",
@ -315,15 +315,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi 0.3.8",
]
[[package]] [[package]]
name = "ansi_term" name = "ansi_term"
version = "0.12.1" version = "0.12.1"
@ -359,17 +350,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.8",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.0" version = "1.0.0"
@ -394,7 +374,7 @@ dependencies = [
"mime", "mime",
"percent-encoding", "percent-encoding",
"rand", "rand",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
"serde_urlencoded 0.6.1", "serde_urlencoded 0.6.1",
] ]
@ -406,7 +386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536" checksum = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536"
dependencies = [ dependencies = [
"backtrace-sys", "backtrace-sys",
"cfg-if", "cfg-if 0.1.10",
"libc", "libc",
"rustc-demangle", "rustc-demangle",
] ]
@ -548,6 +528,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.19" version = "0.4.19"
@ -556,26 +542,11 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [ dependencies = [
"libc", "libc",
"num-integer", "num-integer",
"num-traits", "num-traits 0.2.11",
"time 0.1.44", "time 0.1.44",
"winapi 0.3.8", "winapi 0.3.8",
] ]
[[package]]
name = "clap"
version = "2.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
dependencies = [
"ansi_term 0.11.0",
"atty",
"bitflags",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]] [[package]]
name = "cloudabi" name = "cloudabi"
version = "0.0.3" version = "0.0.3"
@ -585,13 +556,29 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "config"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3"
dependencies = [
"lazy_static",
"nom",
"rust-ini",
"serde 1.0.117",
"serde-hjson",
"serde_json",
"toml",
"yaml-rust",
]
[[package]] [[package]]
name = "console_error_panic_hook" name = "console_error_panic_hook"
version = "0.1.6" version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"wasm-bindgen", "wasm-bindgen",
] ]
@ -646,7 +633,7 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
] ]
[[package]] [[package]]
@ -675,6 +662,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.5" version = "0.4.5"
@ -693,7 +686,7 @@ version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
] ]
[[package]] [[package]]
@ -714,7 +707,7 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" checksum = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"crc32fast", "crc32fast",
"libc", "libc",
"miniz_oxide", "miniz_oxide",
@ -900,7 +893,7 @@ version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"libc", "libc",
"wasi 0.9.0+wasi-snapshot-preview1", "wasi 0.9.0+wasi-snapshot-preview1",
] ]
@ -959,12 +952,14 @@ dependencies = [
[[package]] [[package]]
name = "hoc" name = "hoc"
version = "0.14.5" version = "0.15.0"
dependencies = [ dependencies = [
"actix-rt", "actix-rt",
"actix-web", "actix-web",
"badge", "badge",
"bytes 0.6.0", "bytes 0.6.0",
"config",
"dotenv",
"futures", "futures",
"git2", "git2",
"lazy_static", "lazy_static",
@ -972,10 +967,9 @@ dependencies = [
"openssl-probe", "openssl-probe",
"reqwest", "reqwest",
"ructe", "ructe",
"serde", "serde 1.0.117",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"structopt",
"tempfile", "tempfile",
"tracing", "tracing",
"tracing-actix-web", "tracing-actix-web",
@ -1167,7 +1161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304bccb228c4b020f3a4835d247df0a02a7c4686098d4167762cfbbe4c5cb14" checksum = "2304bccb228c4b020f3a4835d247df0a02a7c4686098d4167762cfbbe4c5cb14"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg-if", "cfg-if 0.1.10",
"rustc_version", "rustc_version",
"ryu", "ryu",
"static_assertions", "static_assertions",
@ -1219,6 +1213,16 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "linked-hash-map"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd"
dependencies = [
"serde 0.8.23",
"serde_test",
]
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.2" version = "0.5.2"
@ -1240,7 +1244,7 @@ version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
] ]
[[package]] [[package]]
@ -1249,10 +1253,10 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed" checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"generator", "generator",
"scoped-tls", "scoped-tls",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
] ]
@ -1262,7 +1266,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
dependencies = [ dependencies = [
"linked-hash-map", "linked-hash-map 0.5.2",
] ]
[[package]] [[package]]
@ -1323,7 +1327,7 @@ version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"fuchsia-zircon", "fuchsia-zircon",
"fuchsia-zircon-sys", "fuchsia-zircon-sys",
"iovec", "iovec",
@ -1383,7 +1387,7 @@ version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"libc", "libc",
"winapi 0.3.8", "winapi 0.3.8",
] ]
@ -1412,7 +1416,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-traits", "num-traits 0.2.11",
]
[[package]]
name = "num-traits"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
dependencies = [
"num-traits 0.2.11",
] ]
[[package]] [[package]]
@ -1459,7 +1472,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52" checksum = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if 0.1.10",
"foreign-types", "foreign-types",
"lazy_static", "lazy_static",
"libc", "libc",
@ -1510,7 +1523,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"cloudabi", "cloudabi",
"libc", "libc",
"redox_syscall", "redox_syscall",
@ -1594,32 +1607,6 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
[[package]]
name = "proc-macro-error"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check 0.9.1",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn-mid",
"version_check 0.9.1",
]
[[package]] [[package]]
name = "proc-macro-hack" name = "proc-macro-hack"
version = "0.5.19" version = "0.5.19"
@ -1764,7 +1751,7 @@ dependencies = [
"native-tls", "native-tls",
"percent-encoding", "percent-encoding",
"pin-project-lite 0.2.0", "pin-project-lite 0.2.0",
"serde", "serde 1.0.117",
"serde_urlencoded 0.7.0", "serde_urlencoded 0.7.0",
"tokio", "tokio",
"tokio-tls", "tokio-tls",
@ -1799,6 +1786,12 @@ dependencies = [
"nom", "nom",
] ]
[[package]]
name = "rust-ini"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2"
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.16" version = "0.1.16"
@ -1888,6 +1881,12 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.117" version = "1.0.117"
@ -1897,6 +1896,19 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-hjson"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8"
dependencies = [
"lazy_static",
"linked-hash-map 0.3.0",
"num-traits 0.1.43",
"regex",
"serde 0.8.23",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.117" version = "1.0.117"
@ -1916,7 +1928,16 @@ checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
"serde", "serde 1.0.117",
]
[[package]]
name = "serde_test"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5"
dependencies = [
"serde 0.8.23",
] ]
[[package]] [[package]]
@ -1927,7 +1948,7 @@ checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
dependencies = [ dependencies = [
"dtoa", "dtoa",
"itoa", "itoa",
"serde", "serde 1.0.117",
"url", "url",
] ]
@ -1940,7 +1961,7 @@ dependencies = [
"form_urlencoded", "form_urlencoded",
"itoa", "itoa",
"ryu", "ryu",
"serde", "serde 1.0.117",
] ]
[[package]] [[package]]
@ -1950,7 +1971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770"
dependencies = [ dependencies = [
"block-buffer", "block-buffer",
"cfg-if", "cfg-if 0.1.10",
"cpuid-bool", "cpuid-bool",
"digest", "digest",
"opaque-debug", "opaque-debug",
@ -2000,7 +2021,7 @@ version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" checksum = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"libc", "libc",
"redox_syscall", "redox_syscall",
"winapi 0.3.8", "winapi 0.3.8",
@ -2040,7 +2061,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde", "serde 1.0.117",
"serde_derive", "serde_derive",
"syn", "syn",
] ]
@ -2054,7 +2075,7 @@ dependencies = [
"base-x", "base-x",
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde", "serde 1.0.117",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"sha1", "sha1",
@ -2067,36 +2088,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "structopt"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8"
dependencies = [
"clap",
"lazy_static",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.48" version = "1.0.48"
@ -2108,24 +2099,13 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "syn-mid"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.1.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"libc", "libc",
"rand", "rand",
"redox_syscall", "redox_syscall",
@ -2133,15 +2113,6 @@ dependencies = [
"winapi 0.3.8", "winapi 0.3.8",
] ]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.20" version = "1.0.20"
@ -2303,6 +2274,15 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "toml"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
dependencies = [
"serde 1.0.117",
]
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.0" version = "0.3.0"
@ -2311,12 +2291,12 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.21" version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 1.0.0",
"pin-project-lite 0.1.4", "pin-project-lite 0.2.0",
"tracing-attributes", "tracing-attributes",
"tracing-core", "tracing-core",
] ]
@ -2381,7 +2361,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b"
dependencies = [ dependencies = [
"serde", "serde 1.0.117",
"tracing-core", "tracing-core",
] ]
@ -2391,12 +2371,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401"
dependencies = [ dependencies = [
"ansi_term 0.12.1", "ansi_term",
"chrono", "chrono",
"lazy_static", "lazy_static",
"matchers", "matchers",
"regex", "regex",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
"sharded-slab", "sharded-slab",
"smallvec", "smallvec",
@ -2434,7 +2414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77" checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"cfg-if", "cfg-if 0.1.10",
"futures", "futures",
"ipconfig", "ipconfig",
"lazy_static", "lazy_static",
@ -2498,12 +2478,6 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]]
name = "unicode-width"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.0" version = "0.2.0"
@ -2537,12 +2511,6 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
[[package]]
name = "vec_map"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "3.1.0" version = "3.1.0"
@ -2593,8 +2561,8 @@ version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"serde", "serde 1.0.117",
"serde_json", "serde_json",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
@ -2620,7 +2588,7 @@ version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
@ -2765,3 +2733,12 @@ dependencies = [
"winapi 0.2.8", "winapi 0.2.8",
"winapi-build", "winapi-build",
] ]
[[package]]
name = "yaml-rust"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
dependencies = [
"linked-hash-map 0.5.2",
]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "hoc" name = "hoc"
version = "0.14.5" version = "0.15.0"
authors = ["Valentin Brandl <vbrandl@riseup.net>"] authors = ["Valentin Brandl <vbrandl@riseup.net>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@ -10,6 +10,8 @@ actix-rt = "1.1.1"
actix-web = "3.2.0" actix-web = "3.2.0"
badge = "0.3.0" badge = "0.3.0"
bytes = "0.6.0" bytes = "0.6.0"
config = { version = "0.10.1", features = ["toml"] }
dotenv = "0.15.0"
futures = "0.3.8" futures = "0.3.8"
git2 = "0.13.12" git2 = "0.13.12"
lazy_static = "1.4.0" lazy_static = "1.4.0"
@ -19,11 +21,10 @@ reqwest = "0.10.9"
serde = "1.0.117" serde = "1.0.117"
serde_derive = "1.0.103" serde_derive = "1.0.103"
serde_json = "1.0.59" serde_json = "1.0.59"
structopt = "0.3.20" tracing = "0.1.22"
tracing = "0.1.21"
tracing-subscriber = "0.2.15"
tracing-actix-web = "0.2.1" tracing-actix-web = "0.2.1"
tracing-futures = "0.2.4" tracing-futures = "0.2.4"
tracing-subscriber = "0.2.15"
[build-dependencies] [build-dependencies]
ructe = "0.13.0" ructe = "0.13.0"

View File

@ -1,6 +1,6 @@
# Hits-of-Code # Hits-of-Code
[![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/view/github/vbrandl/hoc) [![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/github/vbrandl/hoc/view)
[![Drone build](https://drone.vbrandl.net/api/badges/vbrandl/hoc/status.svg)](https://drone.vbrandl.net/vbrandl/hoc) [![Drone build](https://drone.vbrandl.net/api/badges/vbrandl/hoc/status.svg)](https://drone.vbrandl.net/vbrandl/hoc)
[![Gitlab build](https://gitlab.com/vbrandl/hoc/badges/master/pipeline.svg)](https://gitlab.com/vbrandl/hoc/pipelines) [![Gitlab build](https://gitlab.com/vbrandl/hoc/badges/master/pipeline.svg)](https://gitlab.com/vbrandl/hoc/pipelines)
[![dependency status](https://deps.rs/repo/github/vbrandl/hoc/status.svg)](https://deps.rs/repo/github/vbrandl/hoc) [![dependency status](https://deps.rs/repo/github/vbrandl/hoc/status.svg)](https://deps.rs/repo/github/vbrandl/hoc)
@ -26,7 +26,7 @@ where `<service>` is one of `gitub`, `gitlab` or `bitbucket`. The HoC data can a
https://<host>/<service>/<user>/<repo>/json https://<host>/<service>/<user>/<repo>/json
``` ```
There is also an overview page available via `https://<host>/view/<service>/<user>/<repo>` There is also an overview page available via `https://<host>/<service>/<user>/<repo>/view`
To delete a repository and the cache from the server, send a `POST` request to To delete a repository and the cache from the server, send a `POST` request to
`https://<host>/<service>/<user>/<repo>/delete`. On the overview page, there is a button to perform this operation. It `https://<host>/<service>/<user>/<repo>/delete`. On the overview page, there is a button to perform this operation. It
@ -48,21 +48,29 @@ $ docker build .
inside the repository. inside the repository.
I'm currently working on migrating to [nix](https://nixos.org/nix). To get a I'm currently working on migrating to [nix](https://nixos.org/nix). To get a development shell, run `nix-shell`, to
development shell, run `nix-shell`, to build the package run `nix-build --attr build the package run `nix-build --attr package` and to build the Docker image, run `nix-build --attr dockerImage`.
package` and to build the Docker image, run `nix-build --attr dockerImage`.
## Running ## Running
Run either the binary produced by cargo, the Docker container you just built (using docker-compose) or pull the image Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or [`.env.example`](./.env.example) to `.env` and set the
from [Docker Hub](https://hub.docker.com/r/vbrandl/hits-of-code) correct value for `base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv file, you can pass all
parameters directly via environment variables. For variable names see [`.env.example`](./.env.example).
To start a local instance of the service just run:
``` ```
$ docker run -it --rm vbrandl/hits-of-code --help $ HOC_BASE_URL='http://0.0.0.0:8080' ./hoc
``` ```
When running the binary directly, you need a git binary in your `PATH`. You can also use the Docker image:
```
$ docker run -p 8080:8080 --env HOC_BASE_URL='http://0.0.0.0:8080' -it --rm vbrandl/hits-of-code
```
When running the binary directly, you need a `git` binary in your `PATH`.
## License ## License

View File

@ -1,4 +1,4 @@
version: "2" version: "3"
services: services:
hoc: hoc:
@ -9,3 +9,5 @@ services:
# ports: # ports:
# - "127.0.0.1:8080:8080" # - "127.0.0.1:8080:8080"
restart: always restart: always
env_file:
- ./.env

15
hoc.toml.example Normal file
View File

@ -0,0 +1,15 @@
# every parameter can also be set (or overwritten) by passing an environment
# variable namend `HOC_<PARAMETERNAME>`, e.g.
# `HOC_BASE_URL='https://hitsofcode.com' ./hoc`
# these config parameters have default values and must not explicitly be set
repodir = "./repos"
cachedir = "./cache"
port = 8080
host = "0.0.0.0"
workers = 4
# these parameters don't have default values and must be set
# this should be the public base URL of the service, e.g. `https://hitsofcode.com`
base_url = "http://0.0.0.0:8080"

View File

@ -1,41 +1,41 @@
use config::{Config, ConfigError, Environment, File};
use std::path::PathBuf; use std::path::PathBuf;
use structopt::StructOpt;
#[derive(StructOpt, Debug)] #[derive(Debug, Deserialize)]
pub(crate) struct Opt { pub struct Settings {
#[structopt(
short = "o",
long = "outdir",
parse(from_os_str),
default_value = "./repos"
)]
/// Path to store cloned repositories /// Path to store cloned repositories
pub(crate) outdir: PathBuf, pub repodir: PathBuf,
#[structopt(
short = "c",
long = "cachedir",
parse(from_os_str),
default_value = "./cache"
)]
/// Path to store cache /// Path to store cache
pub(crate) cachedir: PathBuf, pub cachedir: PathBuf,
#[structopt(short = "p", long = "port", default_value = "8080")]
/// Port to listen on /// Port to listen on
pub(crate) port: u16, pub port: u16,
#[structopt(short = "h", long = "host", default_value = "0.0.0.0")]
/// Interface to listen on /// Interface to listen on
pub(crate) host: String, pub host: String,
#[structopt(short = "d", long = "domain", default_value = "hitsofcode.com")] /// Base URL
/// Interface to listen on pub base_url: String,
pub(crate) domain: String,
#[structopt(short = "w", long = "workers", default_value = "4")]
/// Number of worker threads /// Number of worker threads
pub(crate) workers: usize, pub workers: usize,
} }
pub(crate) fn init() { pub(crate) fn init() {
dotenv::dotenv().ok();
std::env::set_var("RUST_LOG", "actix_web=info,hoc=info"); std::env::set_var("RUST_LOG", "actix_web=info,hoc=info");
openssl_probe::init_ssl_cert_env_vars(); openssl_probe::init_ssl_cert_env_vars();
tracing_subscriber::fmt().init(); tracing_subscriber::fmt().init();
} }
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
let mut config = Config::new();
config
.merge(File::with_name("hoc.toml").required(false))?
.merge(Environment::with_prefix("hoc"))?
.set_default("repodir", "./repos")?
.set_default("cachedir", "./cache")?
.set_default("workers", 4)?
.set_default("port", 8080)?
.set_default("host", "0.0.0.0")?;
config.try_into()
}
}

View File

@ -215,7 +215,7 @@ where
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.header( .header(
LOCATION, LOCATION,
format!("/view/{}/{}/{}", T::url_path(), data.0, data.1), format!("/{}/{}/{}/view", T::url_path(), data.0, data.1),
) )
.finish()) .finish())
}; };
@ -371,7 +371,7 @@ async fn overview<T: Service>(
let repo_info = RepoInfo { let repo_info = RepoInfo {
commit_url: &T::commit_url(&repo, &head), commit_url: &T::commit_url(&repo, &head),
commits, commits,
domain: &OPT.domain, base_url: &OPT.base_url,
head: &head, head: &head,
hoc, hoc,
hoc_pretty: &hoc_pretty, hoc_pretty: &hoc_pretty,
@ -399,7 +399,7 @@ async fn index() -> Result<HttpResponse> {
&mut buf, &mut buf,
VERSION_INFO, VERSION_INFO,
REPO_COUNT.load(Ordering::Relaxed), REPO_COUNT.load(Ordering::Relaxed),
&OPT.domain, &OPT.base_url,
)?; )?;
Ok(HttpResponse::Ok().content_type("text/html").body(buf)) Ok(HttpResponse::Ok().content_type("text/html").body(buf))
} }
@ -412,7 +412,7 @@ async fn generate(params: web::Form<GeneratorForm<'_>>) -> Result<HttpResponse>
&mut buf, &mut buf,
VERSION_INFO, VERSION_INFO,
REPO_COUNT.load(Ordering::Relaxed), REPO_COUNT.load(Ordering::Relaxed),
&OPT.domain, &OPT.base_url,
params.service.url(), params.service.url(),
params.service.service(), params.service.service(),
&repo, &repo,
@ -442,7 +442,7 @@ fn favicon32() -> HttpResponse {
async fn start_server() -> std::io::Result<()> { async fn start_server() -> std::io::Result<()> {
let interface = format!("{}:{}", OPT.host, OPT.port); let interface = format!("{}:{}", OPT.host, OPT.port);
let state = Arc::new(State { let state = Arc::new(State {
repos: OPT.outdir.display().to_string(), repos: OPT.repodir.display().to_string(),
cache: OPT.cachedir.display().to_string(), cache: OPT.cachedir.display().to_string(),
}); });
HttpServer::new(move || { HttpServer::new(move || {
@ -475,6 +475,9 @@ async fn start_server() -> std::io::Result<()> {
.service(web::resource("/view/github/{user}/{repo}").to(overview::<GitHub>)) .service(web::resource("/view/github/{user}/{repo}").to(overview::<GitHub>))
.service(web::resource("/view/gitlab/{user}/{repo}").to(overview::<Gitlab>)) .service(web::resource("/view/gitlab/{user}/{repo}").to(overview::<Gitlab>))
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>)) .service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
.service(web::resource("/github/{user}/{repo}/view").to(overview::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}/view").to(overview::<Gitlab>))
.service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::<Bitbucket>))
.default_service(web::resource("").route(web::get().to(async_p404))) .default_service(web::resource("").route(web::get().to(async_p404)))
}) })
.workers(OPT.workers) .workers(OPT.workers)

View File

@ -1,6 +1,5 @@
use crate::{config::Opt, count::count_repositories}; use crate::{config::Settings, count::count_repositories};
use std::sync::atomic::AtomicUsize; use std::sync::atomic::AtomicUsize;
use structopt::StructOpt;
pub struct VersionInfo<'a> { pub struct VersionInfo<'a> {
pub commit: &'a str, pub commit: &'a str,
@ -16,7 +15,7 @@ pub(crate) const FAVICON: &[u8] = include_bytes!("../static/favicon32.png");
lazy_static! { lazy_static! {
pub(crate) static ref CLIENT: reqwest::Client = reqwest::Client::new(); pub(crate) static ref CLIENT: reqwest::Client = reqwest::Client::new();
pub(crate) static ref OPT: Opt = Opt::from_args(); pub(crate) static ref OPT: Settings = Settings::new().unwrap();
pub(crate) static ref REPO_COUNT: AtomicUsize = pub(crate) static ref REPO_COUNT: AtomicUsize =
AtomicUsize::new(count_repositories(&OPT.outdir).unwrap()); AtomicUsize::new(count_repositories(&OPT.repodir).unwrap());
} }

View File

@ -1,7 +1,7 @@
pub struct RepoInfo<'a> { pub struct RepoInfo<'a> {
pub commit_url: &'a str, pub commit_url: &'a str,
pub commits: u64, pub commits: u64,
pub domain: &'a str, pub base_url: &'a str,
pub head: &'a str, pub head: &'a str,
pub hoc: u64, pub hoc: u64,
pub hoc_pretty: &'a str, pub hoc_pretty: &'a str,

View File

@ -37,7 +37,9 @@ macro_rules! test_service {
#[actix_rt::test] #[actix_rt::test]
async fn test_index() { async fn test_index() {
let mut app = test::init_service(App::new().service(index)).await; std::env::set_var("HOC_BASE_URL", "http://0.0.0.0:8080");
let mut app = test_app!(index);
let req = dbg!(test::TestRequest::with_uri("/").to_request()); let req = dbg!(test::TestRequest::with_uri("/").to_request());
let resp = dbg!(test::call_service(&mut app, req).await); let resp = dbg!(test::call_service(&mut app, req).await);

View File

@ -1,7 +1,7 @@
@use super::base; @use super::base;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str, url: &str, service: &str, path: &str) @(version_info: VersionInfo, repo_count: usize, base_url: &str, url: &str, service: &str, path: &str)
@:base("Hits-of-Code Badges", "Badge Generator", { @:base("Hits-of-Code Badges", "Badge Generator", {
@ -10,7 +10,7 @@ Here is the markdown for the badge for <a href="https://@url/@path">@url/@path</
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/@service/@path)](https://@domain/view/@service/@path) [![Hits-of-Code](@base_url/@service/@path)](@base_url/@service/@path/view)
</pre> </pre>
<p> <p>
@ -18,6 +18,6 @@ It will be rendered like this
</p> </p>
<pre> <pre>
<a href="https://@domain/view/@service/@path"><img src="https://@domain/@service/@path" alt="example badge" /></a> <a href="@base_url/@service/@path/view"><img src="@base_url/@service/@path" alt="example badge" /></a>
</pre> </pre>
}, version_info, repo_count) }, version_info, repo_count)

View File

@ -1,7 +1,7 @@
@use super::base; @use super::base;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str) @(version_info: VersionInfo, repo_count: usize, base_url: &str)
@:base("Hits-of-Code Badges", "Hits-of-Code Badges", { @:base("Hits-of-Code Badges", "Hits-of-Code Badges", {
@ -24,7 +24,7 @@ used for GitHub, GitLab and Bitbucket repositories. Just put the following code
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](https://@domain/view/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;) [![Hits-of-Code](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;/view)
</pre> </pre>
<p> <p>
@ -33,7 +33,7 @@ following Markdown
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/github/vbrandl/hoc)](https://@domain/view/github/vbrandl/hoc) [![Hits-of-Code](@base_url/github/vbrandl/hoc)](@base_url/github/vbrandl/hoc/view)
</pre> </pre>
<p> <p>
@ -41,7 +41,7 @@ would render this badge:
</p> </p>
<pre> <pre>
<a href="https://@domain/view/github/vbrandl/hoc"><img src="https://@domain/github/vbrandl/hoc" <a href="@base_url/github/vbrandl/hoc/view"><img src="@base_url/github/vbrandl/hoc"
alt="example badge" /></a> alt="example badge" /></a>
</pre> </pre>
@ -55,7 +55,7 @@ in your repository or you want a badge for another branch of your repository, ju
You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object
with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and
<code>head</code> (the commit ref of HEAD). Requesting <a <code>head</code> (the commit ref of HEAD). Requesting <a
href="https://@domain/github/vbrandl/hoc/json">https://@domain/github/vbrandl/hoc/json</a> might return something along href="@base_url/github/vbrandl/hoc/json">@base_url/github/vbrandl/hoc/json</a> might return something along
the lines of the lines of
</p> </p>

View File

@ -19,7 +19,7 @@ To include the badge in your readme, use the following markdown:
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@repo_info.domain/@repo_info.path?branch=@repo_info.branch)](https://@repo_info.domain/view/@repo_info.path?branch=@repo_info.branch) [![Hits-of-Code](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch)](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch/view?branch=@repo_info.branch)
</pre> </pre>