diff --git a/cmd/migration/auth0/migration.go b/cmd/migration/auth0/migration.go index 3d69510..038d1b4 100644 --- a/cmd/migration/auth0/migration.go +++ b/cmd/migration/auth0/migration.go @@ -5,6 +5,7 @@ import ( "encoding/json" "log" "os" + "time" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/spf13/cobra" @@ -28,6 +29,7 @@ var ( passwordPath string outputPath string organisationID string + timeout time.Duration verifiedEmails bool multiLine bool ) @@ -37,6 +39,7 @@ func init() { Cmd.Flags().StringVar(&passwordPath, "passwords", "./passwords.json", "path to the passwords.json") Cmd.Flags().StringVar(&outputPath, "output", "./importBody.json", "path where the generated json will be saved") Cmd.Flags().StringVar(&organisationID, "org", "", "id of the ZITADEL organisation, where the users will be imported") + Cmd.Flags().DurationVar(&timeout, "timeout", 30*time.Minute, "maximum duration to be used for the import") Cmd.Flags().BoolVar(&verifiedEmails, "email-verified", true, "specify if imported emails are automatically verified (default)") Cmd.Flags().BoolVar(&multiLine, "multiline", false, "print the JSON output in multiple lines") } @@ -136,7 +139,7 @@ func CreateZITADELMigration(orgID string, users []User, passwords []Password) *a Orgs: createOrgs(orgID, users, passwords), } importData := &admin.ImportDataRequest{ - Timeout: "30m", + Timeout: timeout.String(), Data: &admin.ImportDataRequest_DataOrgs{ DataOrgs: importDataOrg, }, diff --git a/cmd/migration/auth0/readme.md b/cmd/migration/auth0/readme.md index 11c5349..f1d557a 100644 --- a/cmd/migration/auth0/readme.md +++ b/cmd/migration/auth0/readme.md @@ -4,16 +4,20 @@ With this example an organization in ZITADEL has to be existing and only the use The migration requires the following input: - organisation id (--org) - users.json file with your exported Auth0 users (--users; default is ./users.json) - - password.json file with the exported Auth0 bcrypt passwords (--password; default is ./passwords.json) + - password.json file with the exported Auth0 bcrypt passwords (--passwords; default is ./passwords.json) Execute the transformation and provide at least the organisation id: ```bash ./zitadel-tools migrate auth0 --org= ``` -you can also specify custom path for the users, passwords and output JSON files: +You can specify additional parameters: + - output path (--output; default is ./importBody.json) + - timeout for the import data request (--timeout; default is 30m) + - pretty print the output JSON (--multiline) + ```bash -./zitadel-tools migrate auth0 --org= --users=./users.json --password=./passwords.json --output=./importBody.json +./zitadel-tools migrate auth0 --org= --users=./users.json --passwords=./passwords.json --output=./importBody.json --timeout=1h --multiline ``` You will now get a new file importBody.json