forked from cwtch.im/server
make all config and writeable files respect configDir/CWTCH_HOME
This commit is contained in:
parent
99a4a663e1
commit
de864a845e
|
@ -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
|
||||
|
|
|
@ -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…
Reference in New Issue