Skip to content

Commit

Permalink
also rename variables and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kr committed Apr 21, 2017
1 parent d3d3489 commit 402cf71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cmd/corectl/main.go
Expand Up @@ -28,7 +28,7 @@ import (

// config vars
var (
dataDir = core.DataDirFromEnvironment()
home = core.HomeDirFromEnvironment()
coreURL = env.String("CORE_URL", "http://localhost:1999")

// build vars; initialized by the linker
Expand Down Expand Up @@ -303,8 +303,8 @@ func mustRPCClient() *rpc.Client {
// Note that this function, unlike maybeUseTLS in cored,
// does not load the cert and key from env vars,
// only from the filesystem.
certFile := filepath.Join(dataDir, "tls.crt")
keyFile := filepath.Join(dataDir, "tls.key")
certFile := filepath.Join(home, "tls.crt")
keyFile := filepath.Join(home, "tls.key")
config, err := core.TLSConfig(certFile, keyFile, "")
if err == core.ErrNoTLS {
return &rpc.Client{BaseURL: *coreURL}
Expand Down
8 changes: 4 additions & 4 deletions cmd/cored/main.go
Expand Up @@ -64,7 +64,7 @@ var (
rpsToken = env.Int("RATELIMIT_TOKEN", 0) // reqs/sec
rpsRemoteAddr = env.Int("RATELIMIT_REMOTE_ADDR", 0) // reqs/sec
indexTxs = env.Bool("INDEX_TRANSACTIONS", true)
dataDir = core.DataDirFromEnvironment()
home = core.HomeDirFromEnvironment()
bootURL = env.String("BOOTURL", "")

// build vars; initialized by the linker
Expand Down Expand Up @@ -139,7 +139,7 @@ func main() {
chainlog.Fatalkv(ctx, chainlog.KeyError, err)
}

raftDir := filepath.Join(dataDir, "raft") // TODO(kr): better name for this
raftDir := filepath.Join(home, "raft") // TODO(kr): better name for this
// TODO(tessr): remove tls param once we have tls everywhere
raftDB, err := raft.Start(*listenAddr, raftDir, *bootURL, tlsConfig != nil)
if err != nil {
Expand Down Expand Up @@ -245,8 +245,8 @@ func main() {
// be nil.
func maybeUseTLS(ln net.Listener) (net.Listener, *tls.Config, error) {
config, err := core.TLSConfig(
filepath.Join(dataDir, "tls.crt"),
filepath.Join(dataDir, "tls.key"),
filepath.Join(home, "tls.crt"),
filepath.Join(home, "tls.key"),
*rootCAs,
)
if err == core.ErrNoTLS {
Expand Down
4 changes: 2 additions & 2 deletions core/env.go
Expand Up @@ -5,11 +5,11 @@ import (
"path/filepath"
)

// DataDirFromEnvironment returns the directory to use
// HomeDirFromEnvironment returns the directory to use
// for reading config and storing variable data.
// It returns $CHAIN_CORE_HOME,
// or, if that is empty, $HOME/.chaincore.
func DataDirFromEnvironment() string {
func HomeDirFromEnvironment() string {
if s := os.Getenv("CHAIN_CORE_HOME"); s != "" {
return s
}
Expand Down

0 comments on commit 402cf71

Please sign in to comment.