1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

52 lines
1.7 KiB
Go
Raw Normal View History

2021-03-22 17:35:20 +01:00
package main
2017-05-16 13:39:59 +02:00
import (
2021-12-07 19:11:11 +01:00
"context"
2017-05-16 13:39:59 +02:00
"fmt"
2017-05-19 16:16:14 +02:00
"strconv"
"strings"
2021-03-22 17:35:20 +01:00
2021-10-26 23:11:42 +02:00
"github.com/alice-lg/alice-lg/pkg/config"
"github.com/alice-lg/alice-lg/pkg/http"
"github.com/alice-lg/alice-lg/pkg/store"
2017-05-16 13:39:59 +02:00
)
2017-05-19 16:16:14 +02:00
var banner = []string{
" ** *** Alice ?VERSION ",
" ***** *** * ",
" * *** ** *** Listening on: ?LISTEN",
" *** ** * Routeservers: ?RSCOUNT",
" * ** ** ",
" * ** ** *** **** *** ",
" * ** ** *** * *** * * *** ",
" * ** ** ** * **** * *** ",
" * ** ** ** ** ** *** ",
" ********* ** ** ** ******** ",
" * ** ** ** ** ******* ",
" * ** ** ** ** ** ",
" ***** ** ** ** *** * **** * ",
" * **** ** * *** * *** * ******* ******* ",
"* ** ** *** *** ***** ***** ",
"* ",
" ** ",
2017-05-16 13:39:59 +02:00
}
2021-10-26 23:11:42 +02:00
func printBanner(
cfg *config.Config,
2021-10-27 18:01:13 +00:00
neighborsStore *store.NeighborsStore,
2021-10-26 23:11:42 +02:00
routesStore *store.RoutesStore,
) {
2021-12-07 19:11:11 +01:00
ctx := context.Background()
2022-01-14 11:04:14 +01:00
status, _ := http.CollectAppStatus(ctx, nil, routesStore, neighborsStore)
2017-05-19 16:16:14 +02:00
mapper := strings.NewReplacer(
"?VERSION", status.Version,
2021-03-22 17:35:20 +01:00
"?LISTEN", cfg.Server.Listen,
"?RSCOUNT", strconv.FormatInt(int64(len(cfg.Sources)), 10),
2017-05-19 16:16:14 +02:00
)
2017-05-16 13:39:59 +02:00
for _, l := range banner {
2017-05-19 16:16:14 +02:00
l = mapper.Replace(l)
2017-05-16 13:39:59 +02:00
fmt.Println(l)
}
}