Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions generate/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ func CloudInitFromDescription(str string) StartupScriptKind {

// ServerOptions contains options for the SFU
type ServerOptions struct {
IncludeEgress bool
IncludeIngress bool
Domain string
TURNDomain string
WHIPDomain string // optional, only if WHIP is desired
ServerVersion string
ZeroSSLAPIKey string
LocalRedis bool
CloudInit StartupScriptKind
IncludeEgress bool
IncludeIngress bool
Domain string
TURNDomain string
WHIPDomain string // optional, only if WHIP is desired
ServerVersion string
ZeroSSLAPIKey string
LocalRedis bool
CloudInit StartupScriptKind
CustomApiKey string
CustomApiSecret string

Files ConfigFiles
}
Expand Down
45 changes: 43 additions & 2 deletions generate/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,41 @@ func generateProduction() error {
return err
}

customKeySecret := false
customKeySecretPrompt := promptui.Select{
Label: "Use custom API key and secret?",
Items: []string{
"No - (we'll generate a random one)",
"Yes",
},
Stdout: BellSkipper,
}
idx, _, err = customKeySecretPrompt.Run()
if err != nil {
return err
}
if idx == 1 {
customKeySecret = true
}

if customKeySecret {
prompt = promptui.Prompt{
Label: "Custom API key",
Stdout: BellSkipper,
}
if opts.CustomApiKey, err = prompt.Run(); err != nil {
return err
}

prompt = promptui.Prompt{
Label: "Custom API secret",
Stdout: BellSkipper,
}
if opts.CustomApiSecret, err = prompt.Run(); err != nil {
return err
}
}

if opts.IncludeIngress {
prompt = promptui.Prompt{
Label: "Ingress WHIP domain name (optional, i.e. livekit-whip.myhost.com)",
Expand Down Expand Up @@ -304,8 +339,14 @@ func getLatestVersion() (string, error) {
}

func generateLiveKit(opts *ServerOptions, baseDir string) (*config.Config, error) {
apiKey := utils.NewGuid(utils.APIKeyPrefix)
apiSecret := utils.RandomSecret()
var apiKey, apiSecret string
if opts.CustomApiKey != "" && opts.CustomApiSecret != "" {
apiKey = opts.CustomApiKey
apiSecret = opts.CustomApiSecret
} else {
apiKey = utils.NewGuid(utils.APIKeyPrefix)
apiSecret = utils.RandomSecret()
}
conf := config.Config{
Keys: map[string]string{
apiKey: apiSecret,
Expand Down