1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-26 10:54:13 +08:00

config: change default config dir name to .ipfs

This changes .go-ipfs to .ipfs everywhere.
And by the way this defines a DefaultPathName const
for this name.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
Christian Couder
2015-03-29 13:25:01 +02:00
committed by Juan Batiz-Benet
parent f3fbedf312
commit 96a22c5bb1
22 changed files with 45 additions and 43 deletions

2
.gitignore vendored
View File

@ -8,6 +8,6 @@
*.test *.test
*.orig *.orig
*~ *~
.go-ipfs
/test/bin /test/bin
.ipfs

View File

@ -145,7 +145,7 @@ accomplished with the following command:
### Troubleshooting ### Troubleshooting
If you have previously installed ipfs before and you are running into If you have previously installed ipfs before and you are running into
problems getting a newer version to work, try deleting (or backing up somewhere problems getting a newer version to work, try deleting (or backing up somewhere
else) your ipfs config directory (~/.go-ipfs by default) and rerunning `ipfs init`. else) your ipfs config directory (~/.ipfs by default) and rerunning `ipfs init`.
This will reinitialize the config file to its defaults and clear out the local This will reinitialize the config file to its defaults and clear out the local
datastore of any bad entries. datastore of any bad entries.

View File

@ -49,7 +49,7 @@ Get the value of the 'datastore.path' key:
Set the value of the 'datastore.path' key: Set the value of the 'datastore.path' key:
ipfs config datastore.path ~/.go-ipfs/datastore ipfs config datastore.path ~/.ipfs/datastore
`, `,
}, },

View File

@ -1,6 +1,6 @@
# FUSE # FUSE
As a golang project, `go-ipfs` is easily downloaded and installed with `go get github.com/ipfs/go-ipfs`. All data is stored in a leveldb data store in `~/.go-ipfs/datastore`. If, however, you would like to mount the datastore (`ipfs mount /ipfs`) and use it as you would a normal filesystem, you will need to install fuse. As a golang project, `go-ipfs` is easily downloaded and installed with `go get github.com/ipfs/go-ipfs`. All data is stored in a leveldb data store in `~/.ipfs/datastore`. If, however, you would like to mount the datastore (`ipfs mount /ipfs`) and use it as you would a normal filesystem, you will need to install fuse.
As a precursor, you will have to create the `/ipfs` and `/ipns` directories explicitly. Note that modifying root requires sudo permissions. As a precursor, you will have to create the `/ipfs` and `/ipns` directories explicitly. Note that modifying root requires sudo permissions.

View File

@ -8,6 +8,6 @@ make clean
make test make test
make save_logs make save_logs
docker cp dockertest_server_1:/root/.go-ipfs/logs/events.log $(PWD)/build/server-events.log docker cp dockertest_server_1:/root/.ipfs/logs/events.log $(PWD)/build/server-events.log
docker cp dockertest_bootstrap_1:/root/.go-ipfs/logs/events.log $(PWD)/build/bootstrap-events.log docker cp dockertest_bootstrap_1:/root/.ipfs/logs/events.log $(PWD)/build/bootstrap-events.log
docker cp dockertest_client_1:/root/.go-ipfs/logs/events.log $(PWD)/build/client-events.log docker cp dockertest_client_1:/root/.ipfs/logs/events.log $(PWD)/build/client-events.log

View File

@ -29,8 +29,10 @@ type Config struct {
} }
const ( const (
// DefaultPathName is the default config dir name
DefaultPathName = ".ipfs"
// DefaultPathRoot is the path to the default config dir location. // DefaultPathRoot is the path to the default config dir location.
DefaultPathRoot = "~/.go-ipfs" DefaultPathRoot = "~/" + DefaultPathName
// DefaultConfigFile is the filename of the configuration file // DefaultConfigFile is the filename of the configuration file
DefaultConfigFile = "config" DefaultConfigFile = "config"
// EnvDir is the environment variable used to change the path root. // EnvDir is the environment variable used to change the path root.

View File

@ -2,7 +2,7 @@
// //
// TODO explain the package roadmap... // TODO explain the package roadmap...
// //
// .go-ipfs/ // .ipfs/
// ├── client/ // ├── client/
// | ├── client.lock <------ protects client/ + signals its own pid // | ├── client.lock <------ protects client/ + signals its own pid
// │ ├── ipfs-client.cpuprof // │ ├── ipfs-client.cpuprof

View File

@ -2,7 +2,7 @@ FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024 RUN ipfs init -b=1024
ADD . /tmp/id ADD . /tmp/id
RUN mv -f /tmp/id/config /root/.go-ipfs/config RUN mv -f /tmp/id/config /root/.ipfs/config
RUN ipfs id RUN ipfs id
ENV IPFS_PROF true ENV IPFS_PROF true

View File

@ -5,7 +5,7 @@
}, },
"Datastore": { "Datastore": {
"Type": "leveldb", "Type": "leveldb",
"Path": "/root/.go-ipfs/datastore" "Path": "/root/.ipfs/datastore"
}, },
"Addresses": { "Addresses": {
"Swarm": [ "Swarm": [
@ -30,7 +30,7 @@
"Last": "" "Last": ""
}, },
"Logs": { "Logs": {
"Filename": "/root/.go-ipfs/logs/events.log", "Filename": "/root/.ipfs/logs/events.log",
"MaxSizeMB": 0, "MaxSizeMB": 0,
"MaxBackups": 0, "MaxBackups": 0,
"MaxAgeDays": 0 "MaxAgeDays": 0

View File

@ -2,7 +2,7 @@ FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024 RUN ipfs init -b=1024
ADD . /tmp/id ADD . /tmp/id
RUN mv -f /tmp/id/config /root/.go-ipfs/config RUN mv -f /tmp/id/config /root/.ipfs/config
RUN ipfs id RUN ipfs id
EXPOSE 4031 4032/udp EXPOSE 4031 4032/udp

View File

@ -8,7 +8,7 @@
"Bootstrap": [ "Bootstrap": [
], ],
"Datastore": { "Datastore": {
"Path": "/root/.go-ipfs/datastore", "Path": "/root/.ipfs/datastore",
"Type": "leveldb" "Type": "leveldb"
}, },
"Identity": { "Identity": {
@ -16,7 +16,7 @@
"PrivKey": "CAAS4AQwggJcAgEAAoGBANlJUjOCbPXgYUfo1Pr6nlIjJDPNwN81ACamhaoEZ9VRHXI3fPe7RVAaaXrWLHb892mRqFi1ScE2lcMTLc7WGfyc7dwPqBOZqkVvT0KpCx3Mg246+WvnG8I3HCbWyjSP9tJflOBQxVq6qT2yZSXjNTtDdO4skd4PsPqBco53guYTAgMBAAECgYEAtIcYhrdMNBSSfp5RpZxnwbJ0t52xK0HruDEOSK2UX0Ufg+/aIjEza1QmYupi0xFltg5QojMs7hyd3Q+oNXro5tKsYVeiqrLsUh9jMjaQofzSlV9Oc+bhkkl48YWvF6Y8qx88UYAX+oJqB627H4S1gxLdNEJhPjEAD6n/jql3zUECQQDmHP75wJ7nC4TlxT1SHim5syMAqWNs/SOHnvX8yLrFV9FrMRzsD5qMlIEGBrAjaESzEck6Xpb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NKdDIQN+47FfB1gNgsKw8+6mhv6oFroQJACBF2yssNVXiXa2Na/a9tKYutGvxbm3lXzOvmpkW3FukbsObKYS344J1vdg0nzM6EWQCaiBweSA5TQ27iNW6BzQ=="
}, },
"Logs": { "Logs": {
"Filename": "/root/.go-ipfs/logs/events.log", "Filename": "/root/.ipfs/logs/events.log",
"MaxAgeDays": 0, "MaxAgeDays": 0,
"MaxBackups": 0, "MaxBackups": 0,
"MaxSizeMB": 0 "MaxSizeMB": 0

View File

@ -2,7 +2,7 @@ FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024 RUN ipfs init -b=1024
ADD . /tmp/test ADD . /tmp/test
RUN mv -f /tmp/test/config /root/.go-ipfs/config RUN mv -f /tmp/test/config /root/.ipfs/config
RUN ipfs id RUN ipfs id
RUN chmod +x /tmp/test/run.sh RUN chmod +x /tmp/test/run.sh

View File

@ -8,7 +8,7 @@
"Bootstrap": [ "Bootstrap": [
], ],
"Datastore": { "Datastore": {
"Path": "/root/.go-ipfs/datastore", "Path": "/root/.ipfs/datastore",
"Type": "leveldb" "Type": "leveldb"
}, },
"Identity": { "Identity": {
@ -16,7 +16,7 @@
"PrivKey": "CAAS4AQwggJcAgEAAoGBANW3mJMmDSJbdRyykO0Ze5t6WL6jeTtpOhklxePBIkJL/Uil78Va/tODx6Mvv3GMCkbGvzWslTZXpaHa9vBmjE3MVZSmd5fLRybKT0zZ3juABKcx+WIVNw8JlkpEORihJdwb+5tRUC5pUcMzxqHSmGX+d6e9KZqLnv7piNKg2+r7AgMBAAECgYAqc6+w+wv82SHoM2gqULeG6MScCajZLkvGFwS5+vEtLh7/wUZhc3PO3AxZ0/A5Q9H+wRfWN5PkGYDjJ7WJhzUzGfTbrQ821JV6B3IUR4UHo2IgJkZO4EUB5L9KBUqvYxDJigtGBopgQh0EeDSS+9X8vaGmit5l4zcAfi+UGYPgMQJBAOCJQU8N2HW5SawBo2QX0bnCAAnu5Ilk2QaqwDZbDQaM5JWFcpRpGnjBhsZ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Nj+NGofeOHezRwmLUSUwlgAfdo4bKU1n69t1TrsCNspXYdCMxcPhjQJAMNxkJ8t2tFMpucCQfWJ09wvFKZSHX1/iD9GKWL0Qk2FcMCg3NXiqei5NL3NYqCWpdC/IfjsAEGCJrTFwp/OoUw=="
}, },
"Logs": { "Logs": {
"Filename": "/root/.go-ipfs/logs/events.log", "Filename": "/root/.ipfs/logs/events.log",
"MaxAgeDays": 0, "MaxAgeDays": 0,
"MaxBackups": 0, "MaxBackups": 0,
"MaxSizeMB": 0 "MaxSizeMB": 0

View File

@ -53,7 +53,7 @@ func benchmarkAdd(amount int64) (*testing.BenchmarkResult, error) {
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
env := append( env := append(
[]string{fmt.Sprintf("%s=%s", config.EnvDir, path.Join(tmpDir, ".go-ipfs"))}, // first in order to override []string{fmt.Sprintf("%s=%s", config.EnvDir, path.Join(tmpDir, config.DefaultPathName))}, // first in order to override
os.Environ()..., os.Environ()...,
) )
setupCmd := func(cmd *exec.Cmd) { setupCmd := func(cmd *exec.Cmd) {

View File

@ -43,7 +43,7 @@ func benchmarkAdd(amount int64) (*testing.BenchmarkResult, error) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
env := append(os.Environ(), fmt.Sprintf("%s=%s", config.EnvDir, path.Join(tmpDir, ".go-ipfs"))) env := append(os.Environ(), fmt.Sprintf("%s=%s", config.EnvDir, path.Join(tmpDir, config.DefaultPathName)))
setupCmd := func(cmd *exec.Cmd) { setupCmd := func(cmd *exec.Cmd) {
cmd.Env = env cmd.Env = env
} }

View File

@ -8,6 +8,6 @@ make clean
make test make test
make save_logs make save_logs
docker cp 3nodetest_server_1:/root/.go-ipfs/logs/events.log $(PWD)/build/server-events.log docker cp 3nodetest_server_1:/root/.ipfs/logs/events.log $(PWD)/build/server-events.log
docker cp 3nodetest_bootstrap_1:/root/.go-ipfs/logs/events.log $(PWD)/build/bootstrap-events.log docker cp 3nodetest_bootstrap_1:/root/.ipfs/logs/events.log $(PWD)/build/bootstrap-events.log
docker cp 3nodetest_client_1:/root/.go-ipfs/logs/events.log $(PWD)/build/client-events.log docker cp 3nodetest_client_1:/root/.ipfs/logs/events.log $(PWD)/build/client-events.log

View File

@ -68,11 +68,11 @@ This means cating certain files, or running diagnostic commands.
For example: For example:
``` ```
test_expect_success ".go-ipfs/ has been created" ' test_expect_success ".ipfs/ has been created" '
test -d ".go-ipfs" && test -d ".ipfs" &&
test -f ".go-ipfs/config" && test -f ".ipfs/config" &&
test -d ".go-ipfs/datastore" || test -d ".ipfs/datastore" ||
test_fsh ls -al .go-ipfs test_fsh ls -al .ipfs
' '
``` ```

View File

@ -148,7 +148,7 @@ test_init_ipfs() {
# todo: in the future, use env? # todo: in the future, use env?
test_expect_success "ipfs init succeeds" ' test_expect_success "ipfs init succeeds" '
export IPFS_PATH="$(pwd)/.go-ipfs" && export IPFS_PATH="$(pwd)/.ipfs" &&
ipfs init -b=1024 > /dev/null ipfs init -b=1024 > /dev/null
' '

View File

@ -9,16 +9,16 @@ test_description="Test init command"
. lib/test-lib.sh . lib/test-lib.sh
test_expect_success "ipfs init succeeds" ' test_expect_success "ipfs init succeeds" '
export IPFS_PATH="$(pwd)/.go-ipfs" && export IPFS_PATH="$(pwd)/.ipfs" &&
BITS="2048" && BITS="2048" &&
ipfs init --bits="$BITS" >actual_init ipfs init --bits="$BITS" >actual_init
' '
test_expect_success ".go-ipfs/ has been created" ' test_expect_success ".ipfs/ has been created" '
test -d ".go-ipfs" && test -d ".ipfs" &&
test -f ".go-ipfs/config" && test -f ".ipfs/config" &&
test -d ".go-ipfs/datastore" || test -d ".ipfs/datastore" ||
test_fsh ls -al .go-ipfs test_fsh ls -al .ipfs
' '
test_expect_success "ipfs config succeeds" ' test_expect_success "ipfs config succeeds" '

View File

@ -10,7 +10,7 @@ test_description="Test daemon command"
# this needs to be in a different test than "ipfs daemon --init" below # this needs to be in a different test than "ipfs daemon --init" below
test_expect_success "setup IPFS_PATH" ' test_expect_success "setup IPFS_PATH" '
IPFS_PATH="$(pwd)/.go-ipfs" IPFS_PATH="$(pwd)/.ipfs"
' '
# NOTE: this should remove bootstrap peers (needs a flag) # NOTE: this should remove bootstrap peers (needs a flag)
@ -54,11 +54,11 @@ test_expect_failure "ipfs daemon output looks good" '
test_cmp_repeat_10_sec expected actual_daemon test_cmp_repeat_10_sec expected actual_daemon
' '
test_expect_success ".go-ipfs/ has been created" ' test_expect_success ".ipfs/ has been created" '
test -d ".go-ipfs" && test -d ".ipfs" &&
test -f ".go-ipfs/config" && test -f ".ipfs/config" &&
test -d ".go-ipfs/datastore" || test -d ".ipfs/datastore" ||
test_fsh ls .go-ipfs test_fsh ls .ipfs
' '
# begin same as in t0010 # begin same as in t0010

View File

@ -1 +1 @@
.go-ipfs/ .ipfs/

View File

@ -63,7 +63,7 @@ func run() error {
if err != nil { if err != nil {
return err return err
} }
repoPath := gopath.Join(cwd, ".go-ipfs") repoPath := gopath.Join(cwd, config.DefaultPathName)
if err := ensureRepoInitialized(repoPath); err != nil { if err := ensureRepoInitialized(repoPath); err != nil {
} }
repo, err := fsrepo.Open(repoPath) repo, err := fsrepo.Open(repoPath)