allow disabling Ruleset
This commit is contained in:
@@ -30,6 +30,7 @@ Freedom of information is an essential pillar of democracy and informed decision
|
|||||||
- [x] Disable logs
|
- [x] Disable logs
|
||||||
- [x] No Tracking
|
- [x] No Tracking
|
||||||
- [x] Limit the proxy to a list of domains
|
- [x] Limit the proxy to a list of domains
|
||||||
|
- [x] Expose Ruleset to other ladders
|
||||||
- [ ] Optional TOR proxy
|
- [ ] Optional TOR proxy
|
||||||
- [ ] A key to share only one URL
|
- [ ] A key to share only one URL
|
||||||
- [ ] Fetch from Google Cache if not available
|
- [ ] Fetch from Google Cache if not available
|
||||||
@@ -77,6 +78,10 @@ curl -X GET "http://localhost:8080/api/https://www.example.com"
|
|||||||
### RAW
|
### RAW
|
||||||
http://localhost:8080/raw/https://www.example.com
|
http://localhost:8080/raw/https://www.example.com
|
||||||
|
|
||||||
|
|
||||||
|
### Running Ruleset
|
||||||
|
http://localhost:8080/ruleset
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Ruleset(c *fiber.Ctx) error {
|
func Ruleset(c *fiber.Ctx) error {
|
||||||
|
|
||||||
|
if os.Getenv("EXPOSE_RULESET") == "false" {
|
||||||
|
c.SendStatus(fiber.StatusForbidden)
|
||||||
|
return c.SendString("Rules Disabled")
|
||||||
|
}
|
||||||
|
|
||||||
body, err := yaml.Marshal(rulesSet)
|
body, err := yaml.Marshal(rulesSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.SendStatus(fiber.StatusInternalServerError)
|
c.SendStatus(fiber.StatusInternalServerError)
|
||||||
|
|||||||
Reference in New Issue
Block a user