Skip to content

Commit a0953df

Browse files
default remote execution hostname is remote.sqlc.dev (#2230)
1 parent a8a9ff9 commit a0953df

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

internal/cmd/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
145145
return nil, err
146146
}
147147

148-
if conf.Cloud.Hostname != "" && !e.NoRemote {
148+
if conf.Cloud.Project != "" && !e.NoRemote {
149149
return remoteGenerate(ctx, configPath, conf, dir, stderr)
150150
}
151151

internal/remote/rpc.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ import (
1111
"github.com/kyleconroy/sqlc/internal/config"
1212
)
1313

14+
const defaultHostname = "remote.sqlc.dev"
15+
1416
func NewClient(cloudConfig config.Cloud) (GenClient, error) {
1517
opts := []grpc.DialOption{
1618
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
1719
grpc.WithPerRPCCredentials(bearer.NewPerRPCCredentials(os.Getenv("SQLC_AUTH_TOKEN"))),
1820
}
1921

20-
conn, err := grpc.Dial(cloudConfig.Hostname+":443", opts...)
22+
hostname := cloudConfig.Hostname
23+
if hostname == "" {
24+
hostname = defaultHostname
25+
}
26+
27+
conn, err := grpc.Dial(hostname+":443", opts...)
2128
if err != nil {
2229
return nil, err
2330
}

0 commit comments

Comments
 (0)