hostname-service/main.go

57 lines
1.5 KiB
Go
Raw Normal View History

/*
Copyright 2024 Florian Beisel.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2024-01-17 18:05:55 +01:00
package main
import (
"log"
"git.beisel.it/florian/hostname-service/config"
2024-01-17 18:05:55 +01:00
"git.beisel.it/florian/hostname-service/db"
"git.beisel.it/florian/hostname-service/router"
2024-01-17 18:05:55 +01:00
)
// @title Hostname Service API
// @description This is a sample server for a hostname service.
// @version 1
// @contact.name Florian Beisel
// @contact.url http://git.beisel.it/florian
// @contact.email florian@beisel.it
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
2024-01-17 18:05:55 +01:00
// @host localhost:8080
// @BasePath /api/v1
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
// @description Type "Bearer" followed by a space and JWT token.
func main() {
err := config.LoadConfig()
if err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
db.Init(config.GlobalConfig.DatabaseFile)
2024-01-17 18:05:55 +01:00
router := router.New()
2024-01-17 18:05:55 +01:00
router.Run(":8080")
2024-01-17 18:05:55 +01:00
}