Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

feat: added cloud subcommand to develop against a cloud project#969

Merged
dbarrosop merged 3 commits into
mainfrom
cloud-cli
Jun 25, 2025
Merged

feat: added cloud subcommand to develop against a cloud project#969
dbarrosop merged 3 commits into
mainfrom
cloud-cli

Conversation

@dbarrosop
Copy link
Copy Markdown
Member

@dbarrosop dbarrosop commented Jun 25, 2025

User description

This adds the subcommand nhost cloud to develop against the cloud:

nhost up cloud --subdomain qlcazppbqealeryejopn --postgres-url $POSTGRES_URL
...
Applying migrations...
INFO nothing to apply on database: default
Applying metadata...
Downloading metadata...
INFO Help us improve Hasura! The cli collects anonymized usage stats which
allow us to keep improving Hasura at warp speed. To opt-out or read more,
visit https://hasura.io/docs/latest/graphql/core/guides/telemetry.html
Nhost development environment started.
URLs:
- Console:          https://local.hasura.local.nhost.run
- Dashboard:        https://local.dashboard.local.nhost.run

This will only start the console and the dashboard and will be connected against the specified project (defaulting to the linked project). Any changes done locally should be both reflected in the cloud project and also update the metadata/migrations locally allowing you to use a cloud project as development environment.


PR Type

Enhancement


Description

  • Add nhost cloud command for cloud project development

  • Create cloud-specific Docker Compose configuration

  • Update migration/metadata functions to accept custom endpoints

  • Fix URL scheme constants and authentication redirect URL


Changes walkthrough 📝

Relevant files
Bug fix
1 files
wf_login.go
Fix authentication redirect URL subdomain                               
+1/-1     
Enhancement
5 files
cloud.go
Add cloud development command implementation                         
+317/-0 
up.go
Update migration functions to accept endpoint parameter   
+5/-4     
compose_cloud.go
Create cloud-specific Docker Compose configuration             
+227/-0 
dockercompose.go
Add endpoint parameter to migration methods                           
+6/-6     
main.go
Register cloud command in CLI application                               
+1/-0     
Formatting
2 files
graphql.go
Use scheme constants for URL protocols                                     
+2/-2     
url.go
Replace hardcoded protocols with scheme constants               
+2/-2     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    Hardcoded JWT secret:
    The code contains a hardcoded JWT secret set to "FIXME" which is a placeholder value. This could lead to security vulnerabilities if deployed without proper configuration. Additionally, the admin secret and postgres URL are passed as command-line flags which could be visible in process lists, potentially exposing sensitive credentials.

    ⚡ Recommended focus areas for review

    Hardcoded Secret

    The JWT secret is hardcoded as "FIXME" which is a security concern and indicates incomplete implementation. This should be properly generated or configured.

    ce := clienv.FromCLI(cCtx)
    Typo in Parameter

    Parameter name has a typo - "clouadPostgresURL" should be "cloudPostgresURL". This typo is propagated throughout the function signatures.

    clouadPostgresURL string,
    Error Handling

    The upErr function is called with nolint:contextcheck but the context from the parent function should be passed through for proper cancellation handling.

    return upErr(ce, dc, downOnError, err) //nolint:contextcheck

    @github-actions
    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Security
    Replace hardcoded JWT secret

    The hardcoded jwtSecret value "FIXME" indicates incomplete implementation and could
    lead to security vulnerabilities in production. This should be replaced with a
    proper secret generation or configuration mechanism.

    dockercompose/compose_cloud.go [108]

    -const jwtSecret = "FIXME"
    +jwtSecret := generateSecureJWTSecret() // or pass as parameter
    Suggestion importance[1-10]: 8

    __

    Why: The hardcoded jwtSecret value "FIXME" represents a significant security concern that could lead to vulnerabilities in production environments and should be addressed with proper secret management.

    Medium
    General
    Remove command string whitespace

    The multi-line string contains leading whitespace that will be included in the
    command execution, potentially causing shell parsing issues. Remove the indentation
    from the command string to ensure proper execution.

    dockercompose/compose_cloud.go [67-80]

     console.Command = []string{
     	"bash", "-c",
    -	fmt.Sprintf(`
    -            hasura-cli \
    -              console \
    -              --no-browser \
    -              --endpoint https://%s.hasura.%s.nhost.run \
    -              --address 0.0.0.0 \
    -              --console-port 9695 \
    -              --api-port %d \
    -              --api-host %s://%s.hasura.local.nhost.run \
    -              --console-hge-endpoint https://%s.hasura.%s.nhost.run`,
    +	fmt.Sprintf(`hasura-cli console --no-browser --endpoint https://%s.hasura.%s.nhost.run --address 0.0.0.0 --console-port 9695 --api-port %d --api-host %s://%s.hasura.local.nhost.run --console-hge-endpoint https://%s.hasura.%s.nhost.run`,
     		cloudSubdomain, cloudRegion, httpPort, scheme, subdomain, cloudSubdomain, cloudRegion),
     }
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion correctly identifies potential shell parsing issues with leading whitespace in the multi-line command string, but the impact is moderate as most shells handle this gracefully.

    Low

    @dbarrosop dbarrosop merged commit 90c8eb6 into main Jun 25, 2025
    8 checks passed
    @dbarrosop dbarrosop deleted the cloud-cli branch June 25, 2025 14:49
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants