Browse Source

make all config and writeable files respect configDir/CWTCH_HOME

configDir
Dan Ballard 1 month ago
parent
commit
de864a845e
  1. 5
      app/main.go
  2. 2
      server.go

5
app/main.go

@ -14,6 +14,7 @@ import (
mrand "math/rand"
"os"
"os/signal"
"path"
"syscall"
"time"
)
@ -24,7 +25,7 @@ const (
func main() {
flagDebug := flag.Bool("debug", false, "Enable debug logging")
flagExportTofu := flag.Bool("exportTofuBundle", false, "Export the tofubundle to a file called `tofubundle`")
flagExportTofu := flag.Bool("exportTofuBundle", false, "Export the tofubundle to a file called tofubundle")
flag.Parse()
log.AddEverythingFromPattern("server/app/main")
@ -96,7 +97,7 @@ func main() {
log.Infof("Server Config: server address:%s", base64.StdEncoding.EncodeToString(bundle))
if *flagExportTofu {
ioutil.WriteFile("tofubundle", []byte(tofubundle), 0600)
ioutil.WriteFile(path.Join(serverConfig.ConfigDir, "tofubundle"), []byte(tofubundle), 0600)
}
// Graceful Shutdown

2
server.go

@ -62,7 +62,7 @@ func (s *Server) Run(acn connectivity.ACN) error {
log.Infof("cwtch server running on cwtch:%s\n", addressIdentity+".onion:")
s.metricsPack.Start(service, s.config.ConfigDir, s.config.ServerReporting.LogMetricsToFile)
ms, err := storage.InitializeSqliteMessageStore("cwtch.messages")
ms, err := storage.InitializeSqliteMessageStore(path.Join(s.config.ConfigDir, "cwtch.messages"))
if err != nil {
return fmt.Errorf("could not open database: %v", err)
}

Loading…
Cancel
Save