ref: 97cc548b125593138a8e77a4216d1b545db8a5c7
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.IS_ARCHIVE_NODE == "true" { fmt.Println("Starting Archive Node") go MaintenanceThread(configuration) } if configuration.GRPC_ADDRESS != "" { fmt.Printf("Starting GRPC Server on address: %s\n", configuration.GRPC_ADDRESS) go grpc.RunYatsGrpcServer(configuration.GRPC_ADDRESS) } fmt.Printf("Starting REST Server on address: %s\n", configuration.REST_ADDRESS) RestService(configuration) } |