Just implemented rough functionality. I tested it quickly and it seems to work.
Server now needs its own config: config/ServerDevConfig.toml used for testing
Added new structs to hold Toml config structure: entities/config.go
In the function InitServer we load the config (UUID WILL BE GENERATED BY THE SERVER, leave it empty for new users)
-- We read config in this function generate uuid for each user. For each NOT registered user we generate always new uuid's, if a user is already registered it stays the same
-- We write updated fields back to file
Added new endpoint cwf/register/{username}
User will obtain his uuid with this endpoint and in the config we set registered for this user
After that the user can access all endpoints
I made small adjustments in the wrapper functions where the headers are checked to ignore the register endpoint
Improvements:
I think it makes more sense to call os.Open and not readFile and then writeFile but I am not sure.
Also I check register with strings.Contains
Need to fix typos
Added function to check if UUID is valid but it is not used for now and I think we do not need it but yeah
Just implemented rough functionality. I tested it quickly and it seems to work.
Server now needs its own config: config/ServerDevConfig.toml used for testing
Added new structs to hold Toml config structure: entities/config.go
In the function InitServer we load the config (UUID WILL BE GENERATED BY THE SERVER, leave it empty for new users) -- We read config in this function generate uuid for each user. For each NOT registered user we generate always new uuid's, if a user is already registered it stays the same -- We write updated fields back to file
Added new endpoint cwf/register/{username}
User will obtain his uuid with this endpoint and in the config we set registered for this user
After that the user can access all endpoints
I made small adjustments in the wrapper functions where the headers are checked to ignore the register endpoint
Improvements: I think it makes more sense to call os.Open and not readFile and then writeFile but I am not sure. Also I check register with strings.Contains Need to fix typos Added function to check if UUID is valid but it is not used for now and I think we do not need it but yeah
Added new endpoint cwf/register/{username}