misc: added env support for the other cli flags

This commit is contained in:
Sheen Capadngan
2025-03-19 15:44:56 +08:00
parent 4478dc8659
commit 049f0f56a0
2 changed files with 43 additions and 24 deletions
+12
View File
@@ -47,12 +47,24 @@ var bootstrapCmd = &cobra.Command{
}
organization, _ := cmd.Flags().GetString("organization")
if organization == "" {
if envOrganization, ok := os.LookupEnv("INFISICAL_ADMIN_ORGANIZATION"); ok {
organization = envOrganization
}
}
if organization == "" {
log.Error().Msg("organization is required")
return
}
domain, _ := cmd.Flags().GetString("domain")
if domain == "" {
if envDomain, ok := os.LookupEnv("INFISICAL_API_URL"); ok {
domain = envDomain
}
}
if domain == "" {
log.Error().Msg("domain is required")
return
+10 -3
View File
@@ -19,13 +19,16 @@ The `infisical bootstrap` command is used when deploying Infisical in automated
The command initializes a fresh Infisical instance by creating an admin user, organization, and instance admin machine identity, enabling subsequent programmatic configuration without human intervention.
<Warning>
This command creates an instance admin machine identity with the highest level of privileges. The returned token should be treated with the utmost security, similar to a root credential. Unauthorized access to this token could compromise your entire Infisical instance.
This command creates an instance admin machine identity with the highest level
of privileges. The returned token should be treated with the utmost security,
similar to a root credential. Unauthorized access to this token could
compromise your entire Infisical instance.
</Warning>
## Flags
<Accordion title="--domain" defaultOpen="true">
The URL of your Infisical instance.
The URL of your Infisical instance. This can be set using the `INFISICAL_API_URL` environment variable.
```bash
# Example
@@ -33,6 +36,7 @@ The command initializes a fresh Infisical instance by creating an admin user, or
```
This flag is required.
</Accordion>
<Accordion title="--email">
@@ -44,6 +48,7 @@ The command initializes a fresh Infisical instance by creating an admin user, or
```
This flag is required.
</Accordion>
<Accordion title="--password">
@@ -55,10 +60,11 @@ The command initializes a fresh Infisical instance by creating an admin user, or
```
This flag is required.
</Accordion>
<Accordion title="--organization">
Name of the organization that will be created within the instance.
Name of the organization that will be created within the instance. This can be set using the `INFISICAL_ADMIN_ORGANIZATION` environment variable.
```bash
# Example
@@ -66,6 +72,7 @@ The command initializes a fresh Infisical instance by creating an admin user, or
```
This flag is required.
</Accordion>
## Response