I apologize for bringing up another issue regarding initialization, but I want to ensure I fully understand the topic.
How I understand the system works now
Currently, we can start the server (e.g., by running npm run dev) and the server, based on the configuration, may create the database and repositories at startup. When doing so it would replace any existing database and/or repositories. Therefore, one should start the server once with a configuration that requests the creation of the database and repositories (setup configuration), then change the configuration to remove these options or have a second configuration file (standard configuration).
Typically, during system setup, one would start the server once with the setup configuration, manually verify that the database and repositories have been created, and then stop the server by pressing ctlr-c. Subsequently, the server would be started or restarted as needed using only the standard configuration.
Proposed changes
If I understand correctly, I am wondering if one of these two changes would be desirable and possible:
1. Conditional Creation Option
Have the possibility to specify in the configuration that we want one or two behaviors:
create the database or repositories, only if they do not exist already
create the database or repositories, even if they do not exist already, deleting them and recreating them
This could be done by adding a flag in the configuration of the database and thre repositories (onlyIfNeeded? keepExisting? retentionPolicy?)
This would remove the need for having two configurations and even for running the server once during the setup, just to ensure the creation of the database and the repositories is done. It would be done at the first normal execution, and never again (if the proper configuration is used).
2. Command Line Flags
Alternatively one could specify a flag on the command line called --setup-only. When the flag is specified, the server would exit after creating the database and the repositories. This would remove the need to kill the server. Killing the server "after a while" may be easy for a person to do, but it could be difficult to automatize (do we just use a timeout and hope that the database and repositories creation has finished by the time the timeout expire?). So introducing this flag, would simplify the automation of the setup step.
One could also add an option called --no-setup. When specified the creation of the database and repositories would be skipped, even if specified. If we had these two flags we could avoid having two separate configurations, avoid duplications.
Do you think any of these approaches would make sense?
I apologize for bringing up another issue regarding initialization, but I want to ensure I fully understand the topic.
How I understand the system works now
Currently, we can start the server (e.g., by running
npm run dev
) and the server, based on the configuration, may create the database and repositories at startup. When doing so it would replace any existing database and/or repositories. Therefore, one should start the server once with a configuration that requests the creation of the database and repositories (setup configuration), then change the configuration to remove these options or have a second configuration file (standard configuration).Typically, during system setup, one would start the server once with the setup configuration, manually verify that the database and repositories have been created, and then stop the server by pressing ctlr-c. Subsequently, the server would be started or restarted as needed using only the standard configuration.
Proposed changes
If I understand correctly, I am wondering if one of these two changes would be desirable and possible:
1. Conditional Creation Option
Have the possibility to specify in the configuration that we want one or two behaviors:
onlyIfNeeded
?keepExisting
?retentionPolicy
?)This would remove the need for having two configurations and even for running the server once during the setup, just to ensure the creation of the database and the repositories is done. It would be done at the first normal execution, and never again (if the proper configuration is used).
2. Command Line Flags
Alternatively one could specify a flag on the command line called
--setup-only
. When the flag is specified, the server would exit after creating the database and the repositories. This would remove the need to kill the server. Killing the server "after a while" may be easy for a person to do, but it could be difficult to automatize (do we just use a timeout and hope that the database and repositories creation has finished by the time the timeout expire?). So introducing this flag, would simplify the automation of the setup step.One could also add an option called
--no-setup
. When specified the creation of the database and repositories would be skipped, even if specified. If we had these two flags we could avoid having two separate configurations, avoid duplications.Do you think any of these approaches would make sense?