CreateClientUsers
struct CreateClientUsers : AsyncMigration
A Migration that creates a set of registered client users during startup, from a
registered-clients.txt file located in the seeds/ subdirectory of the project. The file
must be of the format:
clientUsername1:password1:recoveryKey1 clientUsername2:password2:recoveryKey2 …
Note
Each API client that wishes to make use ofClientController endpoints must
provide a client username:password:recovery key triplet prior to production startup.
-
Declaration
Swift
struct ClientUserData -
prepare(on:Asynchronous) Required by
Migrationprotocol. Reads either a test or production text file in theseeds/subdirectory, converts the lines into elements of an array, then iterates over them to create newUsermodels withUserAccessLevelof.client.Requires
registered-clients.txtfile in seeds subdirectory.Declaration
Swift
func prepare(on database: Database) async throwsParameters
connA connection to the database, provided automatically.
Return Value
Void.
-
revert(on:Asynchronous) Required by
Migrationprotocol, but this isn’t a model update, so just return a pre-completedFuture.Declaration
Swift
func revert(on database: Database) async throwsParameters
connThe database connection.
Return Value
Void.
-
Declaration
Swift
func getClients() -> [ClientUserData]
View on GitHub