ref: 9bb99dda673271328bf65b4d4fa43b32875aa3a4
server/yats.go
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 39 40 41 42 43 44 45 46 47 48 49 |
/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli <kevwe.com> * @copyright Paolo Lulli 2024 */ package main import ( "fmt" "os" "yats-server/config" "yats-server/db" "yats-server/grpc" ) var configuration config.Configuration var instanceName = "default" func main() { args := os.Args if len(args) < 2 { fmt.Println("Loading default config") configuration = config.GetConfig(os.Getenv("HOME") + "/.yats.json") } else { instanceName = args[1] fmt.Printf("Loading instance: [%s] config", instanceName) configuration = config.GetConfig(os.Getenv("HOME") + "/.yats/" + instanceName + ".json") } db.Session = db.InitializeDb(configuration) if configuration.IsArchiveNode == "true" { fmt.Println("Starting Archive Node") go MaintenanceThread(configuration) } if configuration.GrpcAddress != "" { fmt.Printf("Starting GRPC Server on address: %s\n", configuration.GrpcAddress) go grpc.RunYatsGrpcServer(configuration.GrpcAddress) } fmt.Printf("Starting REST Server on address: %s\n", configuration.RestAddress) RestService(configuration) } |