MCPcopy Create free account
hub / github.com/GetStream/stream-cli / questions

Function questions

pkg/cmd/config/config.go:152–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150}
151
152func questions() []*survey.Question {
153 return []*survey.Question{
154 {
155 Name: "name",
156 Prompt: &survey.Input{Message: "What is the name of your app? (eg. prod, staging, testing)"},
157 Validate: survey.Required,
158 },
159 {
160 Name: "accessKey",
161 Prompt: &survey.Input{Message: "What is your access key?"},
162 Validate: survey.ComposeValidators(
163 survey.Required,
164 survey.MinLength(10),
165 survey.MaxLength(30)),
166 },
167 {
168 Name: "accessSecretKey",
169 Prompt: &survey.Password{Message: "What is your access secret key?"},
170 Validate: survey.ComposeValidators(
171 survey.Required,
172 survey.MinLength(50),
173 survey.MaxLength(75)),
174 },
175 {
176 Name: "ChatURL",
177 Prompt: &survey.Input{
178 Message: "(optional) Which base URL do you want to use for Chat?",
179 Default: cfg.DefaultChatEdgeURL,
180 },
181 Validate: func(ans interface{}) error {
182 u, ok := ans.(string)
183 if !ok {
184 return errors.New("invalid url")
185 }
186
187 _, err := url.ParseRequestURI(u)
188 if err != nil {
189 return errors.New("invalid url format make sure it matches <scheme>://<host>")
190 }
191 return nil
192 },
193 Transform: func(ans interface{}) interface{} {
194 s, ok := ans.(string)
195
196 if !ok || s == "" {
197 return cfg.DefaultChatEdgeURL
198 }
199
200 return s
201 },
202 },
203 }
204}

Callers 1

runQuestionnaireFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected