Skip to content

Commit

Permalink
adding getter function on config
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrick Widjaya authored and fwidjaya20 committed Nov 12, 2023
1 parent e1f0729 commit d45c934
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
37 changes: 22 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0] - 2023-09-16
## [1.1.3] - 2023-11-12

### Added

- Support `Config` feature.
- Support `Console` feature.
- Support `Database` feature.
- Support `Event` feature.
- Support `Log` feature.
- Support `Schedule` feature.
- Support `Queue` feature
- Adding `GetArrayString` function on config

### [1.1.0] - 2023-09-26
## [1.1.2] - 2023-10-17

### Added

- Support `Queue` feature with `Sync` and `Redis` drivers.
- Adding `GetInt`, `GetInt8`, `GetInt16`, `GetInt32`, `GetInt64` function on config.

### Fixed

- Ignore migrations if no migration or seeder files.

### [1.1.1] - 2023-10-04
## [1.1.1] - 2023-10-04

### Added

- Support `Queue` feature with `RabbitMQ` driver.

### [1.1.2] - 2023-10-17
## [1.1.0] - 2023-09-26

### Added

- Adding `GetInt`, `GetInt8`, `GetInt16`, `GetInt32`, `GetInt64` function on config.
- Support `Queue` feature with `Sync` and `Redis` drivers.

### Fixed
## [1.0.0] - 2023-09-16

- Ignore migrations if no migration or seeder files.
### Added

- Support `Config` feature.
- Support `Console` feature.
- Support `Database` feature.
- Support `Event` feature.
- Support `Log` feature.
- Support `Schedule` feature.
- Support `Queue` feature

[1.1.3]: https://github.com/fwidjaya20/symphonic/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/fwidjaya20/symphonic/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/fwidjaya20/symphonic/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/fwidjaya20/symphonic/compare/v1.0.0...v1.1.0
Expand Down
11 changes: 11 additions & 0 deletions config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"log"
"os"
"strings"

"github.com/spf13/cast"
"github.com/spf13/viper"
Expand Down Expand Up @@ -73,6 +74,16 @@ func (app *Application) GetString(name string, defaultValue ...string) string {
return cast.ToString(app.Get(name, defaultValue))
}

func (app *Application) GetArrayString(name string, delimiter string, defaultValues ...string) []string {
str := app.GetString(name, "")

if len(str) == 0 {
return defaultValues
}

return cast.ToStringSlice(strings.Split(str, delimiter))
}

func (app *Application) Inspect() any {
return app.viper.AllSettings()
}

0 comments on commit d45c934

Please sign in to comment.