mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-28 11:58:16 +00:00
fix cli config loading and correct comment (#3618)
closes #3553 https://github.com/woodpecker-ci/woodpecker/pull/3518#discussion_r1542662674
This commit is contained in:
@@ -57,7 +57,7 @@ func After(_ *cli.Context) error {
|
|||||||
if waitForUpdateCheck != nil {
|
if waitForUpdateCheck != nil {
|
||||||
select {
|
select {
|
||||||
case <-waitForUpdateCheck.Done():
|
case <-waitForUpdateCheck.Done():
|
||||||
// When the actual command already finished, we still wait 250ms for the update check to finish
|
// When the actual command already finished, we still wait 500ms for the update check to finish
|
||||||
case <-time.After(time.Millisecond * 500):
|
case <-time.After(time.Millisecond * 500):
|
||||||
log.Debug().Msg("Update check stopped due to timeout")
|
log.Debug().Msg("Update check stopped due to timeout")
|
||||||
cancelWaitForUpdate(errors.New("update check timeout"))
|
cancelWaitForUpdate(errors.New("update check timeout"))
|
||||||
|
@@ -30,9 +30,12 @@ func Load(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if config == nil && !c.IsSet("server-url") && !c.IsSet("token") {
|
if config == nil {
|
||||||
log.Info().Msg("The woodpecker-cli is not yet set up. Please run `woodpecker-cli setup`")
|
config = &Config{
|
||||||
return errors.New("woodpecker-cli is not setup")
|
LogLevel: "info",
|
||||||
|
ServerURL: c.String("server-url"),
|
||||||
|
Token: c.String("token"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.IsSet("server") {
|
if !c.IsSet("server") {
|
||||||
@@ -56,6 +59,11 @@ func Load(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.ServerURL == "" || config.Token == "" {
|
||||||
|
log.Info().Msg("The woodpecker-cli is not yet set up. Please run `woodpecker-cli setup` or provide the required environment variables / flags.")
|
||||||
|
return errors.New("woodpecker-cli is not configured")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user