Brijesh's Git Server — identity @ 8c36e39b8c6eda064ffa45901a976c3ebf028d97

authentication service

core/cmd/main.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
package main

import (
	"fmt"
	"os"

	"github.com/wbrijesh/identity/internal/database"
	"github.com/wbrijesh/identity/internal/server"
)

func init() {
	dbService := database.New()
	dbService.RunMigrations()
}

func PrintInColor256(text string, color int) {
	fmt.Printf("\x1b[38;5;%dm%s\x1b[0m\n", color, text)
}

func printAsciiArt() {
	PrintInColor256(" ___    _            _   _ _         ", 172)
	PrintInColor256("|_ _|__| | ___ _ __ | |_(_) |_ _   _ ", 172)
	PrintInColor256(" | |/ _` |/ _ \\ '_ \\| __| | __| | | |", 172)
	PrintInColor256(" | | (_| |  __/ | | | |_| | |_| |_| |", 172)
	PrintInColor256("|___\\__,_|\\___|_| |_|\\__|_|\\__|\\__, |", 172)
	PrintInColor256("                               |___/ ", 172)
}

func main() {
	printAsciiArt()
	server := server.NewServer()
	fmt.Println("Server is starting on port", os.Getenv("PORT"))

	err := server.ListenAndServe()
	if err != nil {
		panic(fmt.Sprintf("cannot start server: %s", err))
	}
}