runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<DbCreateSuperuserOption> commandConfig,
) async {
final projectId = commandConfig.value(DbCreateSuperuserOption.projectId);
final username = commandConfig.value(DbCreateSuperuserOption.username);
final apiCloudClient = runner.serviceProvider.cloudApiClient;
try {
final password = await apiCloudClient.database.createSuperUser(
cloudCapsuleId: projectId,
username: username,
);
logger.success(
'''
DB superuser created. The password is only shown this once:
$password''',
);
} on Exception catch (e, stackTrace) {
throw FailureException.nested(
e, stackTrace, 'Failed to create superuser');
}
}