2020-06-25 16:12:59 +00:00
|
|
|
package params
|
|
|
|
|
2020-07-11 16:43:26 +00:00
|
|
|
import (
|
|
|
|
"os"
|
2021-01-04 22:48:42 +00:00
|
|
|
"runtime"
|
2020-07-11 16:43:26 +00:00
|
|
|
"time"
|
|
|
|
)
|
2020-06-25 16:12:59 +00:00
|
|
|
|
|
|
|
// IoConfig defines the shared io parameters.
|
|
|
|
type IoConfig struct {
|
2020-07-09 14:05:43 +00:00
|
|
|
ReadWritePermissions os.FileMode
|
|
|
|
ReadWriteExecutePermissions os.FileMode
|
2020-07-11 16:43:26 +00:00
|
|
|
BoltTimeout time.Duration
|
2020-06-25 16:12:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var defaultIoConfig = &IoConfig{
|
2020-07-11 16:43:26 +00:00
|
|
|
ReadWritePermissions: 0600, //-rw------- Read and Write permissions for user
|
|
|
|
ReadWriteExecutePermissions: 0700, //-rwx------ Read Write and Execute (traverse) permissions for user
|
|
|
|
BoltTimeout: 1 * time.Second, // 1 second for the bolt DB to timeout.
|
2020-06-25 16:12:59 +00:00
|
|
|
}
|
|
|
|
|
2021-01-04 22:48:42 +00:00
|
|
|
var defaultWindowsIoConfig = &IoConfig{
|
|
|
|
ReadWritePermissions: 0666,
|
|
|
|
ReadWriteExecutePermissions: 0777,
|
|
|
|
BoltTimeout: 1 * time.Second,
|
|
|
|
}
|
|
|
|
|
2020-06-25 16:12:59 +00:00
|
|
|
// BeaconIoConfig returns the current io config for
|
|
|
|
// the beacon chain.
|
|
|
|
func BeaconIoConfig() *IoConfig {
|
2021-01-04 22:48:42 +00:00
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
return defaultWindowsIoConfig
|
|
|
|
}
|
2020-06-25 16:12:59 +00:00
|
|
|
return defaultIoConfig
|
|
|
|
}
|