mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 14:28:02 +08:00
go-ipfs-config: S3 datastore support
To test it, set up an S3 bucket (in an AWS region that is not US
Standard, for read-after-write consistency), run `ipfs init`, then
edit `~/.ipfs/config` to say
"Datastore": {
"Type": "s3",
"Region": "us-west-1",
"Bucket": "mahbukkit",
"ACL": "private"
},
with the right values. Set `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` in the environment and you should be able to
run `ipfs add` and `ipfs cat` and see the bucket be populated.
No automated tests exist, unfortunately. S3 is thorny to simulate.
License: MIT
Signed-off-by: Tommi Virtanen <tv@eagain.net>
This commit is contained in:
parent
3f419cc599
commit
45deffe50e
@ -1,5 +1,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// DefaultDataStoreDirectory is the directory to store all the local IPFS data.
|
||||
const DefaultDataStoreDirectory = "datastore"
|
||||
|
||||
@ -10,6 +14,22 @@ type Datastore struct {
|
||||
StorageMax string // in B, kB, kiB, MB, ...
|
||||
StorageGCWatermark int64 // in percentage to multiply on StorageMax
|
||||
GCPeriod string // in ns, us, ms, s, m, h
|
||||
|
||||
Params *json.RawMessage
|
||||
}
|
||||
|
||||
func (d *Datastore) ParamData() []byte {
|
||||
if d.Params == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return []byte(*d.Params)
|
||||
}
|
||||
|
||||
type S3Datastore struct {
|
||||
Region string `json:"region"`
|
||||
Bucket string `json:"bucket"`
|
||||
ACL string `json:"acl"`
|
||||
}
|
||||
|
||||
// DataStorePath returns the default data store path given a configuration root
|
||||
|
||||
Loading…
Reference in New Issue
Block a user