Skip to content

Commit

Permalink
Gate to flex
Browse files Browse the repository at this point in the history
  • Loading branch information
DAlperin committed Feb 2, 2023
1 parent c2d2480 commit fb7a7f6
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions flypg/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,25 +375,28 @@ func (l *Launcher) setSecrets(ctx context.Context, config *CreateClusterInput) (
return nil, err
}

pub, priv, err := ed25519.GenerateKey(nil)
if err != nil {
return nil, err
}

app := api.App{Name: config.AppName}
cert, err := l.client.IssueSSHCertificate(ctx, config.Organization, []string{"root", "fly", "postgres"}, []api.App{app}, nil, pub)
if err != nil {
return nil, err
}

pemkey := ssh.MarshalED25519PrivateKey(priv, "postgres inter-machine ssh")

secrets := map[string]string{
"SU_PASSWORD": suPassword,
"REPL_PASSWORD": replPassword,
"OPERATOR_PASSWORD": opPassword,
"SSH_KEY": string(pemkey),
"SSH_CERT": cert.Certificate,
}

if config.Manager == ReplicationManager {
pub, priv, err := ed25519.GenerateKey(nil)
if err != nil {
return nil, err
}

app := api.App{Name: config.AppName}
cert, err := l.client.IssueSSHCertificate(ctx, config.Organization, []string{"root", "fly", "postgres"}, []api.App{app}, nil, pub)
if err != nil {
return nil, err
}

pemkey := ssh.MarshalED25519PrivateKey(priv, "postgres inter-machine ssh")

secrets["SSH_KEY"] = string(pemkey)
secrets["SSH_CERT"] = cert.Certificate
}

if config.SnapshotID != nil {
Expand Down

0 comments on commit fb7a7f6

Please sign in to comment.