mirror of
https://github.com/TwiN/gatus.git
synced 2025-04-09 18:40:09 +02:00
Rename storage type inmemory to memory
This is technically a breaking change, but given how long ago this field was implemented as well as the fact that this is the default value if the type is not specified, I doubt anybody's explicitly setting it as inmemory
This commit is contained in:
parent
4ada6ee7c9
commit
3cbe068fc1
@ -229,10 +229,10 @@ Here are some examples of conditions you can use:
|
|||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
|:------------------ |:-------------------------------------------------------------------------------------- |:-------------- |
|
|:------------------ |:-------------------------------------------------------------------------------------- |:-------------- |
|
||||||
| `storage` | Storage configuration | `{}` |
|
| `storage` | Storage configuration | `{}` |
|
||||||
| `storage.file` | File to persist the data in. If the type is `inmemory`, data is persisted on interval. | `""` |
|
| `storage.file` | File to persist the data in. If the type is `memory`, data is persisted on interval. | `""` |
|
||||||
| `storage.type` | Type of storage. Valid types: `inmemory`, `sqlite`. | `"inmemory"` |
|
| `storage.type` | Type of storage. Valid types: `memory`, `sqlite`. | `"memory"` |
|
||||||
|
|
||||||
- If `storage.type` is `inmemory` (default) and `storage.file` is set to a non-blank value.
|
- If `storage.type` is `memory` (default) and `storage.file` is set to a non-blank value.
|
||||||
Furthermore, the data is periodically persisted, but everything remains in memory.
|
Furthermore, the data is periodically persisted, but everything remains in memory.
|
||||||
- If `storage.type` is `sqlite`, `storage.file` must not be blank.
|
- If `storage.type` is `sqlite`, `storage.file` must not be blank.
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -177,7 +177,7 @@ func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
|
|||||||
func validateStorageConfig(config *Config) error {
|
func validateStorageConfig(config *Config) error {
|
||||||
if config.Storage == nil {
|
if config.Storage == nil {
|
||||||
config.Storage = &storage.Config{
|
config.Storage = &storage.Config{
|
||||||
Type: storage.TypeInMemory,
|
Type: storage.TypeMemory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err := storage.Initialize(config.Storage)
|
err := storage.Initialize(config.Storage)
|
||||||
|
@ -57,7 +57,7 @@ func Initialize(cfg *Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case TypeInMemory:
|
case TypeMemory:
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
if len(cfg.File) > 0 {
|
if len(cfg.File) > 0 {
|
||||||
|
@ -32,13 +32,13 @@ func TestInitialize(t *testing.T) {
|
|||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "inmemory-no-file",
|
Name: "memory-no-file",
|
||||||
Cfg: &Config{Type: TypeInMemory},
|
Cfg: &Config{Type: TypeMemory},
|
||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "inmemory-with-file",
|
Name: "memory-with-file",
|
||||||
Cfg: &Config{Type: TypeInMemory, File: t.TempDir() + "/TestInitialize_inmemory-with-file.db"},
|
Cfg: &Config{Type: TypeMemory, File: t.TempDir() + "/TestInitialize_memory-with-file.db"},
|
||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,6 @@ package storage
|
|||||||
type Type string
|
type Type string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TypeInMemory Type = "inmemory" // In-memory store
|
TypeMemory Type = "memory" // In-memory store
|
||||||
TypeSQLite Type = "sqlite" // SQLite store
|
TypeSQLite Type = "sqlite" // SQLite store
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user