Signed-off-by: Evan Jarrett evan@evanjarrett.com
+21
-3
spindle/server.go
History
2 rounds
7 comments
1 commit
expand
collapse
Signed-off-by: Evan Jarrett <evan@evanjarrett.com>
expand 4 comments
how is the motd overridden in this scenario? SetMotd is not being called anywhere.
Its not called in tangled core. I'm using tangled as a libary and I was opening it as a way for me to set the motd directly with a []byte, rather than go through the original route I was going to do by setting the MOTD_FILE in the config. I can still go that route, but seems like its going to refactored based on boltless's commit to add datadir.
sounds good, lgtm!
1 commit
expand
collapse
Signed-off-by: Evan Jarrett <evan@evanjarrett.com>
expand 3 comments
Thank you for the contribution!
I'd prefer motd file path and db path to be fixed under configurable spindle data dir (see commit), so I might eventually change the config schema later.
But this seems good to merge for now!
I'm using the config directly and specifying my own path to an embedded motd
if _, err := motdFile.Write(motd); err != nil {
setupLog.Error(err, "failed to write MOTD temp file")
os.Exit(1)
}
motdFile.Close()
spindleCfg.Server.MOTDFile = motdFile.Name()
If so, you can do same for {cfg.DataDir}/motd file.
// spindle/config.go
func (s Server) MotdPath() string {
return filepath.Join(s.DataDir, "motd")
}
// ...
if err := os.WriteFile(path, data, 0644); err != nil {
setupLog.Error(err, "failed to write MOTD file")
os.Exit(1)
}
Just write embedded motd bytes to {cfg.DataDir}/motd file.
Instead of setting the files via the config, what I really want is to just set the byte content directly. I have updated the PR to reflect this.