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

Commit 4eccf67

Browse files
author
Lars Gierth
committed
Add Gateway.APICommands for /api allowlists
1 parent b13380f commit 4eccf67

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-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: 23 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,28 @@ 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+
"get",
105+
"ls",
106+
"resolve",
107+
"name/resolve",
108+
"dag/get",
109+
"dag/resolve",
110+
"object/data",
111+
"object/links",
112+
"object/get",
113+
"object/stat",
114+
"refs",
115+
"block/stat",
116+
"block/get",
117+
"dns",
118+
"version",
119+
}
120+
}
121+
99122
func addressesConfig() Addresses {
100123
return Addresses{
101124
Swarm: []string{

0 commit comments

Comments
 (0)