Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit 2c818da

Browse files
author
Lars Gierth
committed
Add Gateway.APICommands for /api allowlists
1 parent 66ebd9c commit 2c818da

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

gateway.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ type Gateway struct {
66
RootRedirect string
77
Writable bool
88
PathPrefixes []string
9+
APICommands []string
910
}

init.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
6666
"Access-Control-Allow-Methods": []string{"GET"},
6767
"Access-Control-Allow-Headers": []string{"X-Requested-With", "Range"},
6868
},
69+
APICommands: DefaultGatewayAPICommands(),
6970
},
7071
Reprovider: Reprovider{
7172
Interval: "12h",
@@ -96,6 +97,27 @@ const DefaultConnMgrLowWater = 600
9697
// grace period
9798
const DefaultConnMgrGracePeriod = time.Second * 20
9899

100+
func DefaultGatewayAPICommands() []string {
101+
return []string{
102+
"commands",
103+
"cat",
104+
"block/stat",
105+
"block/get",
106+
"get",
107+
"dns",
108+
"ls",
109+
"name/resolve",
110+
"object/data",
111+
"object/links",
112+
"object/get",
113+
"object/stat",
114+
"dag/get",
115+
"dag/resolve",
116+
"resolve",
117+
"version",
118+
}
119+
}
120+
99121
func addressesConfig() Addresses {
100122
return Addresses{
101123
Swarm: []string{

0 commit comments

Comments
 (0)