731 Service creation script #808

Merged
a24julot merged 14 commits from 731-Service-creation-script into team_1_week_5 2026-05-11 08:13:42 +00:00
Collaborator

Script that generates a new service according to #731's template.

Needs to be tested and reviewed on both a Windows system and an Unix system.

Script that generates a new service according to #731's template. Needs to be tested and reviewed on both a Windows system and an Unix system.
Created the script files inside the ./service folder. Will start with the batch one
Added folder creation
The template for services are done, with all necessary files. Not modular at all. Also there is a problem with capitalization since batch doesn't feature it on its own.
Added all the necessary components for testing and linked the projects. Also fixed parts that wasn't using the service name.
Made the decision that the user has to input the capitalized name manually, since Batch doesn't feature such a command.
Added Unix variant
Switched from " to '
Moved the scripts to the scripts directory, also added pathing to the service folder
Minor bugfixes:
- The .dll file was not created with the service name
- The comparison in the Unix script was not checking the right name
a24julot 2026-05-08 09:15:33 +00:00
Collaborator

There is an issue with upper case and lower case. I informed the developer. He will inform back and I can test.

There is an issue with upper case and lower case. I informed the developer. He will inform back and I can test.
a24sakma requested changes 2026-05-08 09:59:58 +00:00
Dismissed
a24sakma left a comment
Collaborator

There is an issue with upper case and lower case. I informed the developer. He will inform back and I can test.

There is an issue with upper case and lower case. I informed the developer. He will inform back and I can test.
Switched from bash to tr string conversion since tr bash conversion didn't work on all bash versions and probably not on MacOS.
a24sakma left a comment
Collaborator

There is still an issue in redirect.

There is still an issue in redirect.
Changed Unix script to avoid <<< as it can cause error with some shells.
Author
Collaborator

Noticed something when I was fixing my own service that uses this script, on line 163 (Unix) and 168 (Windows) where the connectionString is written as "Host=PostgreSQL;Port=5432;Database=users;UsercapitalName={DbUser};Password={DbPassword}". All services are not using the users database, and honestly, there isn't a good way of selecting this since the script can't know if the service is for a sensor or something else.

The best solution is one that we are already planning; each service has its own database. Then the name of the service could be used. Until then, the script will assign it to the sensors database.

Noticed something when I was fixing my own service that uses this script, on line 163 (Unix) and 168 (Windows) where the connectionString is written as `"Host=PostgreSQL;Port=5432;Database=users;UsercapitalName={DbUser};Password={DbPassword}"`. All services are not using the users database, and honestly, there isn't a good way of selecting this since the script can't know if the service is for a sensor or something else. The best solution is one that we are already planning; each service has its own database. Then the name of the service could be used. Until then, the script will assign it to the sensors database.
users -> sensors happened
a24sakma left a comment
Collaborator

The scripts seems to be working.

I just want to add it needs to be documented somewhere that we need to add into README or somewhere that for Linux it needs to be running without sh SCRIPT_NAME @a24julot @a22erigr

The scripts seems to be working. I just want to add it needs to be documented somewhere that we need to add into README or somewhere that for Linux it needs to be running without `sh SCRIPT_NAME` @a24julot @a22erigr
Collaborator

@a24timsv wrote in #808 (comment):

Noticed something when I was fixing my own service that uses this script, on line 163 (Unix) and 168 (Windows) where the connectionString is written as "Host=PostgreSQL;Port=5432;Database=users;UsercapitalName={DbUser};Password={DbPassword}". All services are not using the users database, and honestly, there isn't a good way of selecting this since the script can't know if the service is for a sensor or something else.

The best solution is one that we are already planning; each service has its own database. Then the name of the service could be used. Until then, the script will assign it to the sensors database.

as improvement it could be that the second input you give the information whether it is a sensor or api. As the structure of the api differs from sensor. This could be an imporvement but does not need to be fixed in this issue.

@a24timsv wrote in https://git.webug.se/Andras/BoundlessFlowCampus2K/pulls/808#issuecomment-9164: > Noticed something when I was fixing my own service that uses this script, on line 163 (Unix) and 168 (Windows) where the connectionString is written as `"Host=PostgreSQL;Port=5432;Database=users;UsercapitalName={DbUser};Password={DbPassword}"`. All services are not using the users database, and honestly, there isn't a good way of selecting this since the script can't know if the service is for a sensor or something else. > > The best solution is one that we are already planning; each service has its own database. Then the name of the service could be used. Until then, the script will assign it to the sensors database. as improvement it could be that the second input you give the information whether it is a sensor or api. As the structure of the api differs from sensor. This could be an imporvement but does not need to be fixed in this issue.
Yet another small bugfix where Username had been changed to usercapital_name in a change all occurrences previously done.
Collaborator

Very useful. I create an improvement issue for the api.

Very useful. I create an improvement issue for the api.
Collaborator

@a24julot you can merge this one.

@a24julot you can merge this one.
a24julot merged commit 5e8c3e2430 into team_1_week_5 2026-05-11 08:13:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!808
No description provided.