Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: config init #2147

Merged
merged 26 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
610f5ec
feat(wip): config init command experiment
markphelps Sep 18, 2023
de92e35
chore: rm deprecated fields from config
markphelps Sep 18, 2023
0a4bc1f
chore: yaml struct tags
markphelps Sep 19, 2023
8bc2a66
chore: fix tests
markphelps Sep 19, 2023
a767cb8
chore: rm deprecated items
markphelps Sep 19, 2023
62bb723
chore: merge main
markphelps Sep 19, 2023
547cd91
chore: impl marshall yaml
markphelps Sep 19, 2023
97814e2
chore: only log path if not empty
markphelps Sep 19, 2023
8e421f8
chore: runE
markphelps Sep 19, 2023
bdac886
chore: errors
markphelps Sep 19, 2023
02e90e3
chore: refactor errors on startup
markphelps Sep 19, 2023
fa1e234
Merge branch 'main' into mp/config-init
markphelps Sep 21, 2023
656e8d8
chore: add some examples for use
markphelps Sep 21, 2023
3f25516
chore: write yaml schema line at top
markphelps Sep 21, 2023
5f2080c
chore: update CLI test
markphelps Sep 21, 2023
6432094
chore: update json schema
markphelps Sep 21, 2023
109cb11
chore: merge main
markphelps Sep 21, 2023
8bfa792
feat: add force flag to overwrite existing config
markphelps Sep 21, 2023
24fee64
feat: allow for passing in config file
markphelps Sep 22, 2023
c4ae7ef
chore: merge main
markphelps Sep 22, 2023
156ff67
chore: fix merge conflict
markphelps Sep 22, 2023
9cfb468
chore: dont marshal disabled config properties by default
markphelps Sep 22, 2023
96d8f65
chore: fix cli test
markphelps Sep 22, 2023
d57ab67
chore: add yaml marshal test for config
markphelps Sep 22, 2023
64dc874
Merge branch 'main' into mp/config-init
markphelps Sep 25, 2023
940da83
Merge branch 'main' into mp/config-init
markphelps Sep 25, 2023
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
67 changes: 14 additions & 53 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,71 +54,32 @@ Enabling OpenTelemetry tracing with the Jaeger expoerter via `tracing.jaeger` is
backend: jaeger
```

### ui.enabled

> since [v1.17.0](https://github.com/flipt-io/flipt/releases/tag/v1.17.0)

An upcoming release will enable the UI always and this option will be removed.
There will be a new version of Flipt (headless) that will run Flipt without the UI and only include the API.

### db.migrations.path and db.migrations_path

> since [v1.14.0](https://github.com/flipt-io/flipt/releases/tag/v1.14.0)

These options are no longer considered during Flipt execution.
Database migrations are embedded directly within the Flipt binary.

### API ListFlagRequest, ListSegmentRequest, ListRuleRequest offset

> since [v1.13.0](https://github.com/flipt-io/flipt/releases/tag/v1.13.0)

`offset` has been deprecated in favor of `page_token`/`next_page_token` for `ListFlagRequest`, `ListSegmentRequest` and `ListRuleRequest`. See: [#936](https://github.com/flipt-io/flipt/issues/936).

### cache.memory.enabled

> since [v1.10.0](https://github.com/flipt-io/flipt/releases/tag/v1.10.0)

Enabling in-memory cache via `cache.memory` is deprecated in favor of setting the `cache.backend` to `memory` and `cache.enabled` to `true`.

=== Before

``` yaml
cache:
memory:
enabled: true
```

=== After

``` yaml
cache:
enabled: true
backend: memory
```
## Expired Deprecation Notices

### cache.memory.expiration
The following options were deprecated in the past and were already removed.

> since [v1.10.0](https://github.com/flipt-io/flipt/releases/tag/v1.10.0)
### ui.enabled

Setting cache expiration via `cache.memory` is deprecated in favor of setting the `cache.backend` to `memory` and `cache.ttl` to the desired duration.
> deprecated in [v1.17.0](https://github.com/flipt-io/flipt/releases/tag/v1.17.0)
> removed in [v1.28.0](https://github.com/flipt-io/flipt/releases/tag/v1.28.0)

=== Before
### db.migrations.path and db.migrations_path

``` yaml
cache:
memory:
expiration: 1m
```
> deprecated in [v1.14.0](https://github.com/flipt-io/flipt/releases/tag/v1.14.0)
> removed in [v1.28.0](https://github.com/flipt-io/flipt/releases/tag/v1.28.0)

=== After
### cache.memory.enabled

``` yaml
cache:
enabled: true
backend: memory
ttl: 1m
```
> deprecated in [v1.10.0](https://github.com/flipt-io/flipt/releases/tag/v1.10.0)
> removed in [v1.28.0](https://github.com/flipt-io/flipt/releases/tag/v1.28.0)

## Expired Deprecation Notices
### cache.memory.expiration

The following options were deprecated in the past and were already removed.
> deprecated in [v1.10.0](https://github.com/flipt-io/flipt/releases/tag/v1.10.0)
> removed in [v1.28.0](https://github.com/flipt-io/flipt/releases/tag/v1.28.0)
65 changes: 65 additions & 0 deletions cmd/flipt/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package main

import (
"os"

"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
"go.flipt.io/flipt/internal/config"
"gopkg.in/yaml.v2"
)

func newConfigCommand() *cobra.Command {
var configCmd = &cobra.Command{
Use: "config",
Short: "Manage Flipt configuration",
}

var initCmd = &cobra.Command{
markphelps marked this conversation as resolved.
Show resolved Hide resolved
Use: "init",
Short: "Initialize Flipt configuration",
RunE: func(cmd *cobra.Command, args []string) error {
cfg := config.Default()
out, err := yaml.Marshal(cfg)
if err != nil {
return err
}

answer := struct {
File string
}{}

q := []*survey.Question{
{
Name: "file",
Prompt: &survey.Input{
Message: "Configuration file path:",
Default: fliptConfigFile,
},
Validate: survey.Required,
},
}

if err := survey.Ask(q, &answer); err != nil {
return err
}

// check if file exists
if _, err := os.Stat(answer.File); err == nil {
// file exists
overwrite := false
prompt := &survey.Confirm{
Message: "File exists. Overwrite?",
}
if err := survey.AskOne(prompt, &overwrite); err != nil {
return err
}
}

return os.WriteFile(answer.File, out, 0600)
},
}

configCmd.AddCommand(initCmd)
return configCmd
}
28 changes: 2 additions & 26 deletions cmd/flipt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"go.flipt.io/flipt/internal/config"
"go.flipt.io/flipt/internal/info"
"go.flipt.io/flipt/internal/release"
"go.flipt.io/flipt/internal/storage/sql"
"go.flipt.io/flipt/internal/telemetry"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -98,30 +97,6 @@ func main() {
},
}

migrateCmd = &cobra.Command{
Use: "migrate",
Short: "Run pending database migrations",
Run: func(cmd *cobra.Command, _ []string) {
logger, cfg := buildConfig()
defer func() {
_ = logger.Sync()
}()

migrator, err := sql.NewMigrator(*cfg, logger)
if err != nil {
logger.Fatal("initializing migrator", zap.Error(err))
}

defer migrator.Close()

if err := migrator.Up(true); err != nil {
logger.Fatal("running migrator", zap.Error(err))
}
},
}
)

var (
t = template.Must(template.New("banner").Parse(bannerTmpl))
buf = new(bytes.Buffer)
)
Expand All @@ -144,10 +119,11 @@ func main() {
rootCmd.Flags().BoolVar(&forceMigrate, "force-migrate", false, "force migrations before running")
_ = rootCmd.Flags().MarkHidden("force-migrate")

rootCmd.AddCommand(migrateCmd)
rootCmd.AddCommand(newMigrateCommand())
rootCmd.AddCommand(newExportCommand())
rootCmd.AddCommand(newImportCommand())
rootCmd.AddCommand(newValidateCommand())
rootCmd.AddCommand(newConfigCommand())

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
31 changes: 31 additions & 0 deletions cmd/flipt/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"github.com/spf13/cobra"
"go.flipt.io/flipt/internal/storage/sql"
"go.uber.org/zap"
)

func newMigrateCommand() *cobra.Command {
return &cobra.Command{
Use: "migrate",
Short: "Run pending database migrations",
Run: func(cmd *cobra.Command, _ []string) {
logger, cfg := buildConfig()
defer func() {
_ = logger.Sync()
}()

migrator, err := sql.NewMigrator(*cfg, logger)
if err != nil {
logger.Fatal("initializing migrator", zap.Error(err))
}

defer migrator.Close()

if err := migrator.Up(true); err != nil {
logger.Fatal("running migrator", zap.Error(err))
}
},
}
}
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.20

require (
cuelang.org/go v0.6.0
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/Masterminds/squirrel v1.5.4
github.com/XSAM/otelsql v0.25.0
github.com/aws/aws-sdk-go-v2 v1.21.0
Expand Down Expand Up @@ -132,14 +133,16 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.16.6 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
Expand Down Expand Up @@ -181,6 +184,7 @@ require (
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
Expand Down
17 changes: 15 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic=
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand All @@ -56,6 +58,8 @@ github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg=
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/XSAM/otelsql v0.25.0 h1:ji1G+O45lrmZV9pXv2jQNRzYVFIwEB0jlY0XXdgpuNk=
Expand Down Expand Up @@ -150,6 +154,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
Expand Down Expand Up @@ -340,6 +345,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down Expand Up @@ -395,6 +402,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC
github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down Expand Up @@ -445,13 +454,16 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
Expand Down Expand Up @@ -898,6 +910,7 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
Expand Down
23 changes: 7 additions & 16 deletions internal/cmd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,13 @@ func NewHTTPServer(
})
})

// TODO: remove (deprecated as of 1.17)
if cfg.UI.Enabled {
fs, err := ui.FS()
if err != nil {
return nil, fmt.Errorf("mounting ui: %w", err)
}

r.Mount("/", http.FileServer(http.FS(fs)))
fs, err := ui.FS()
if err != nil {
return nil, fmt.Errorf("mounting ui: %w", err)
}

r.Mount("/", http.FileServer(http.FS(fs)))

server.Server = &http.Server{
Addr: fmt.Sprintf("%s:%d", cfg.Server.Host, httpPort),
Handler: r,
Expand All @@ -190,18 +187,12 @@ func NewHTTPServer(

if isConsole {
color.Green("\nAPI: %s", apiAddr)

if cfg.UI.Enabled {
color.Green("UI: %s", uiAddr)
}
color.Green("UI: %s", uiAddr)

fmt.Println()
} else {
logger.Info("api available", zap.String("address", apiAddr))

if cfg.UI.Enabled {
logger.Info("ui available", zap.String("address", uiAddr))
}
logger.Info("ui available", zap.String("address", uiAddr))
}

if cfg.Server.Protocol != config.HTTPS {
Expand Down
Loading
Loading