rename module to full github path. (#53)

This commit is contained in:
Miroslav Šedivý
2022-04-09 17:03:01 +02:00
committed by GitHub
parent 2622586f11
commit 4708fb9371
20 changed files with 61 additions and 50 deletions
+13 -8
View File
@@ -15,7 +15,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"m1k1o/neko_rooms"
nekoRooms "github.com/m1k1o/neko-rooms"
)
func Execute() error {
@@ -23,10 +23,10 @@ func Execute() error {
}
var root = &cobra.Command{
Use: "neko_rooms",
Short: "neko_rooms server",
Long: `neko_rooms server`,
Version: neko_rooms.Service.Version.String(),
Use: "neko-rooms",
Short: "neko-rooms server",
Long: `neko-rooms server`,
Version: nekoRooms.Service.Version.String(),
}
func init() {
@@ -49,6 +49,7 @@ func init() {
logs := filepath.Join(".", "logs")
if runtime.GOOS == "linux" {
// TODO: Change to neko-rooms.
logs = "/var/log/neko_rooms"
}
@@ -56,9 +57,11 @@ func init() {
os.Mkdir(logs, os.ModePerm)
}
// TODO: Change to neko-rooms.
latest := filepath.Join(logs, "neko_rooms-latest.log")
_, err := os.Stat(latest)
if err == nil {
// TODO: Change to neko-rooms.
err = os.Rename(latest, filepath.Join(logs, "neko_rooms."+time.Now().Format("2006-01-02T15-04-05Z07-00")+".log"))
if err != nil {
log.Panic().Err(err).Msg("failed to rotate log file")
@@ -85,10 +88,12 @@ func init() {
viper.SetConfigFile(config) // Use config file from the flag.
} else {
if runtime.GOOS == "linux" {
// TODO: Change to neko-rooms.
viper.AddConfigPath("/etc/neko_rooms/")
}
viper.AddConfigPath(".")
// TODO: Change to config.
viper.SetConfigName("neko_rooms")
}
@@ -118,12 +123,12 @@ func init() {
logger.Info().Msg("preflight complete")
}
neko_rooms.Service.Configs.Root.Set()
nekoRooms.Service.Configs.Root.Set()
})
if err := neko_rooms.Service.Configs.Root.Init(root); err != nil {
if err := nekoRooms.Service.Configs.Root.Init(root); err != nil {
log.Panic().Err(err).Msg("unable to run root command")
}
root.SetVersionTemplate(neko_rooms.Service.Version.Details())
root.SetVersionTemplate(nekoRooms.Service.Version.Details())
}