Skip to content

Commit

Permalink
change(config): rename git backend filesystem to local (#3110)
Browse files Browse the repository at this point in the history
Signed-off-by: George MacRorie <me@georgemac.com>
  • Loading branch information
GeorgeMac committed May 24, 2024
1 parent 4f30e3d commit 21e9e7e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
15 changes: 8 additions & 7 deletions config/flipt.schema.cue
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ import "strings"
min_idle_conn?: int | *0
conn_max_idle_time?: =~#duration | int | *0
net_timeout?: =~#duration | int | *0
ca_cert_path?: string
ca_cert_bytes?: string
insecure_skip_tls?: bool | *false
ca_cert_path?: string
ca_cert_bytes?: string
insecure_skip_tls?: bool | *false
}

memory?: {
Expand All @@ -142,9 +142,9 @@ import "strings"
}

#cloud: {
host?: string | *"flipt.cloud"
organization?: string
instance?: string
host?: string | *"flipt.cloud"
organization?: string
instance?: string
authentication?: {
api_key?: string
}
Expand Down Expand Up @@ -176,6 +176,7 @@ import "strings"
local?: path: string | *"."
git?: {
repository: string
backend?: *"memory" | "local"
ref?: string | *"main"
ref_type?: *"static" | "semver"
directory?: string
Expand Down Expand Up @@ -347,7 +348,7 @@ import "strings"
body: string
headers?: [string]: string
}]
},
}
cloud?: {
enabled?: bool | *false
}
Expand Down
5 changes: 5 additions & 0 deletions config/flipt.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@
"repository": {
"type": "string"
},
"backend": {
"type": "string",
"enum": ["memory", "local"],
"default": "local"
},
"ref": {
"type": "string",
"default": "main"
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func TestLoad(t *testing.T) {
Type: GitStorageType,
Git: &Git{
Backend: GitBackend{
Type: GitBackendFilesystem,
Type: GitBackendLocal,
Path: "/path/to/gitdir",
},
Ref: "main",
Expand Down
4 changes: 2 additions & 2 deletions internal/config/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func (g *Git) validate() error {
type GitBackendType string

const (
GitBackendMemory = GitBackendType("memory")
GitBackendFilesystem = GitBackendType("filesystem")
GitBackendMemory = GitBackendType("memory")
GitBackendLocal = GitBackendType("local")
)

type GitBackend struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ storage:
git:
repository: "git@github.com:foo/bar.git"
backend:
type: "filesystem"
type: "local"
path: "/path/to/gitdir"
2 changes: 1 addition & 1 deletion internal/storage/fs/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewStore(ctx context.Context, logger *zap.Logger, cfg *config.Config) (_ st
}

switch storage.Backend.Type {
case config.GitBackendFilesystem:
case config.GitBackendLocal:
path := storage.Backend.Path
if path == "" {
path, err = os.MkdirTemp(os.TempDir(), "flipt-git-*")
Expand Down

0 comments on commit 21e9e7e

Please sign in to comment.