This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow multiple API/Gateway addresses
Alternative to #6 that doesn't require a migration.
- Loading branch information
Showing
3 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
// Strings is a helper type that can decode a single string into a string slice. | ||
type Strings []string | ||
|
||
func (o *Strings) UnmarshalJSON(data []byte) error { | ||
if data[0] == '[' { | ||
return json.Unmarshal(data, (*[]string)(o)) | ||
} | ||
var value string | ||
if err := json.Unmarshal(data, &value); err != nil { | ||
return err | ||
} | ||
*o = []string{value} | ||
return nil | ||
} | ||
|
||
// Addresses stores the (string) multiaddr addresses for the node. | ||
type Addresses struct { | ||
Swarm []string // addresses for the swarm to listen on | ||
Announce []string // swarm addresses to announce to the network | ||
NoAnnounce []string // swarm addresses not to announce to the network | ||
API string // address for the local API (RPC) | ||
Gateway string // address to listen on for IPFS HTTP object gateway | ||
API Strings // address for the local API (RPC) | ||
Gateway Strings // address to listen on for IPFS HTTP object gateway | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters