Skip to content

Commit

Permalink
Merge pull request #12 from eliona-smart-building-assistant/Testing-E…
Browse files Browse the repository at this point in the history
…rror-Fixing

Testing error fixing
  • Loading branch information
airvine-leicom authored Mar 31, 2023
2 parents 2f6a68b + 49b8d62 commit 75bdc36
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
10 changes: 5 additions & 5 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ func occupancyToInt(occupancy string) int64 {
}
}

// listenApi starts the API server and listen for requests
func listenApi() {
http.ListenApiWithOs(&nethttp.Server{Addr: ":" + common.Getenv("API_SERVER_PORT", "3000"), Handler: apiserver.NewRouter(

func listenApiRequests() {
err := nethttp.ListenAndServe(":"+common.Getenv("API_SERVER_PORT", "3000"), apiserver.NewRouter(
apiserver.NewConfigurationApiController(apiservices.NewConfigurationApiService()),
apiserver.NewVersionApiController(apiservices.NewVersionApiService()),
apiserver.NewCustomizationApiController(apiservices.NewCustomizationApiService()),
apiserver.NewSpacesApiController(apiservices.NewSpacesApiService()),
)})
))
log.Fatal("main", "Error in API Server: %v", err)
}
2 changes: 1 addition & 1 deletion icon

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ import (
"github.com/eliona-smart-building-assistant/go-utils/common"
"github.com/eliona-smart-building-assistant/go-utils/db"
"github.com/eliona-smart-building-assistant/go-utils/log"
"github.com/volatiletech/sqlboiler/v4/boil"
)

// The main function starts the app by starting all services necessary for this app and waits
// until all services are finished.
func main() {
log.Info("main", "Starting the app.")

database := db.Database(app.AppName())
defer database.Close()
boil.SetDB(database)
// Necessary to close used init resources, because db.Pool() is used in this app.
defer db.ClosePool()

// Init the app before the first run.
app.Init(db.Pool(), app.AppName(),
asset.InitAssetTypeFile("eliona/asset-type-thingdust_space.json"),
Expand All @@ -43,14 +49,17 @@ func main() {
)
common.WaitForWithOs(
common.Loop(CheckConfigsandSetActiveState, time.Second),
listenApi,
listenApiRequests,
)

// At the end set all configuration inactive
_, err := conf.SetAllConfigsInactive(context.Background())
if err != nil {
log.Error("conf", "setting all configs inactive: %v", err)
}

log.Info("main", "Terminate the app.")

}


8 changes: 4 additions & 4 deletions reset.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ DELETE FROM public.heap
WHERE asset_id IN (
SELECT asset_id
FROM public.asset
WHERE asset_type LIKE 'thingdust_%'
WHERE asset_type LIKE E'thingdust\\_%'
);

DELETE FROM public.attribute_schema
WHERE asset_type LIKE 'thingdust_%';
WHERE asset_type LIKE E'thingdust\\_%';

DELETE FROM public.asset
WHERE asset_type LIKE 'thingdust_%';
WHERE asset_type LIKE E'thingdust\\_%';

DELETE FROM public.asset_type
WHERE asset_type LIKE 'thingdust_%';
WHERE asset_type LIKE E'thingdust\\_%';

DELETE FROM public.widget_data
WHERE widget_id IN (
Expand Down

0 comments on commit 75bdc36

Please sign in to comment.