package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"path"

	"github.com/loisBN/zippytal_node/localserver"
)

func main() {
	nodePath, err := os.Executable()
	if err != nil {
		log.Fatalln(err)
	}
	nodePath = path.Dir(nodePath)
	if err = os.Chdir(nodePath); err != nil {
		log.Fatalln(err)
	}
	config, err := localserver.NewLocalServerConfig(nodePath,nodePath)
	if err != nil {
		log.Fatalln(err)
	}
	localserver, err := localserver.NewLocalServer(2448,".", config.NodeId, config.Token)
	if err != nil {
		log.Fatalln(err)
	}
	bytes, err := os.ReadFile("logo.txt")
	if err == nil {
		fmt.Println(string(bytes))
	}
	log.Fatalln(localserver.GrpcClientManager.Handle(context.Background()))
}
