Browse Source

Fix main app settings variable name collision

feature/improve-code-stability
Roman Zipp 3 years ago
parent
commit
88230d5109
  1. 10
      main.go

10
main.go

@ -45,22 +45,22 @@ func RegisterPipelineRoutes(r *mux.Router, pipelines []pipelines.IPipeline, stor
} }
func main() { func main() {
settings, err := settings.LoadSettings(afero.NewOsFs())
appSettings, err := settings.LoadSettings(afero.NewOsFs())
if err != nil { if err != nil {
panic(err) panic(err)
} }
var storageProvider storage.IStorageProvider var storageProvider storage.IStorageProvider
if settings.StorageProvider.Type == 0 {
storageProvider = storage.GetFileSystemStorageProvider(settings.StorageProvider.BasePath, "")
if appSettings.StorageProvider.Type == 0 {
storageProvider = storage.GetFileSystemStorageProvider(appSettings.StorageProvider.BasePath, "")
} else { } else {
panic("Invalid file system provided!") panic("Invalid file system provided!")
} }
pipes := pipelines.LoadPipelines() pipes := pipelines.LoadPipelines()
authMiddleware := auth.CreateAuthenticationMiddleware(settings.Token)
authMiddleware := auth.CreateAuthenticationMiddleware(appSettings.Token)
r := mux.NewRouter() r := mux.NewRouter()
r.Use(authMiddleware.Middleware) r.Use(authMiddleware.Middleware)
@ -68,7 +68,7 @@ func main() {
RegisterPipelineRoutes(r, pipes, storageProvider) RegisterPipelineRoutes(r, pipes, storageProvider)
err = http.ListenAndServe(settings.Endpoint, r)
err = http.ListenAndServe(appSettings.Endpoint, r)
if err != nil { if err != nil {
panic(err) panic(err)
} }

Loading…
Cancel
Save