Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit a46a4b6

Browse files
authored
feat: deprecate data-folder and expose branch flags (#966)
1 parent 2d1a0dd commit a46a4b6

6 files changed

Lines changed: 5 additions & 25 deletions

File tree

clienv/clienv.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func FromCLI(cCtx *cli.Context) *CliEnv {
6767
cwd,
6868
cCtx.String(flagRootFolder),
6969
cCtx.String(flagDotNhostFolder),
70-
cCtx.String(flagDataFolder),
7170
cCtx.String(flagNhostFolder),
7271
),
7372
authURL: cCtx.String(flagAuthURL),

clienv/filesystem.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@ type PathStructure struct {
99
workingDir string
1010
root string
1111
dotNhostFolder string
12-
dataFolder string
1312
nhostFolder string
1413
}
1514

1615
func NewPathStructure(
17-
workingDir, root, dotNhostFolder, dataFolder, nhostFolder string,
16+
workingDir, root, dotNhostFolder, nhostFolder string,
1817
) *PathStructure {
1918
return &PathStructure{
2019
workingDir: workingDir,
2120
root: root,
2221
dotNhostFolder: dotNhostFolder,
23-
dataFolder: dataFolder,
2422
nhostFolder: nhostFolder,
2523
}
2624
}
@@ -37,10 +35,6 @@ func (p PathStructure) DotNhostFolder() string {
3735
return p.dotNhostFolder
3836
}
3937

40-
func (p PathStructure) DataFolder() string {
41-
return p.dataFolder
42-
}
43-
4438
func (p PathStructure) NhostFolder() string {
4539
return p.nhostFolder
4640
}

clienv/flags.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const (
1515
flagBranch = "branch"
1616
flagProjectName = "project-name"
1717
flagRootFolder = "root-folder"
18-
flagDataFolder = "data-folder"
1918
flagNhostFolder = "nhost-folder"
2019
flagDotNhostFolder = "dot-nhost-folder"
2120
flagLocalSubdomain = "local-subdomain"
@@ -38,7 +37,7 @@ func getGitBranchName() string {
3837
return head.Name().Short()
3938
}
4039

41-
func Flags() ([]cli.Flag, error) { //nolint:funlen
40+
func Flags() ([]cli.Flag, error) {
4241
fullWorkingDir, err := os.Getwd()
4342
if err != nil {
4443
return nil, fmt.Errorf("failed to get working directory: %w", err)
@@ -48,7 +47,6 @@ func Flags() ([]cli.Flag, error) { //nolint:funlen
4847

4948
workingDir := "."
5049
dotNhostFolder := filepath.Join(workingDir, ".nhost")
51-
dataFolder := filepath.Join(dotNhostFolder, "data", branch)
5250
nhostFolder := filepath.Join(workingDir, "nhost")
5351

5452
return []cli.Flag{
@@ -68,10 +66,10 @@ func Flags() ([]cli.Flag, error) { //nolint:funlen
6866
},
6967
&cli.StringFlag{ //nolint:exhaustruct
7068
Name: flagBranch,
71-
Usage: "Git branch name",
69+
Usage: "Git branch name. If not set, it will be detected from the current git repository. This flag is used to dynamically create docker volumes for each branch. If you want to have a static volume name or if you are not using git, set this flag to a static value.", //nolint:lll
7270
EnvVars: []string{"BRANCH"},
7371
Value: branch,
74-
Hidden: true,
72+
Hidden: false,
7573
},
7674
&cli.StringFlag{ //nolint:exhaustruct
7775
Name: flagRootFolder,
@@ -87,13 +85,6 @@ func Flags() ([]cli.Flag, error) { //nolint:funlen
8785
Value: dotNhostFolder,
8886
Category: "Project structure",
8987
},
90-
&cli.StringFlag{ //nolint:exhaustruct
91-
Name: flagDataFolder,
92-
Usage: "Data folder to persist data\n\t",
93-
EnvVars: []string{"NHOST_DATA_FOLDER"},
94-
Value: dataFolder,
95-
Category: "Project structure",
96-
},
9788
&cli.StringFlag{ //nolint:exhaustruct
9889
Name: flagNhostFolder,
9990
Usage: "Path to nhost folder\n\t",

cmd/config/validate_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ func TestValidate(t *testing.T) {
254254
".",
255255
filepath.Join("testdata", "validate", tc.path),
256256
filepath.Join("testdata", "validate", tc.path, ".nhost"),
257-
filepath.Join("testdata", "validate", tc.path, ".nhost", "data"),
258257
filepath.Join("testdata", "validate", tc.path, "nhost"),
259258
),
260259
"fakeauthurl",

cmd/dev/up.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ func up( //nolint:funlen,cyclop
363363
httpPort,
364364
useTLS,
365365
postgresPort,
366-
ce.Path.DataFolder(),
367366
ce.Path.NhostFolder(),
368367
ce.Path.DotNhostFolder(),
369368
ce.Path.Root(),

dockercompose/compose.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ func getServices( //nolint: funlen,cyclop
515515
httpPort uint,
516516
useTLS bool,
517517
postgresPort uint,
518-
dataFolder string,
519518
nhostFolder string,
520519
dotNhostFolder string,
521520
rootFolder string,
@@ -535,6 +534,7 @@ func getServices( //nolint: funlen,cyclop
535534
}
536535

537536
pgVolumeName := "pgdata_" + sanitizeBranch(branch)
537+
dataFolder := filepath.Join(dotNhostFolder, "data")
538538
postgres, err := postgres(cfg, subdomain, postgresPort, dataFolder, pgVolumeName)
539539
if err != nil {
540540
return nil, err
@@ -636,7 +636,6 @@ func ComposeFileFromConfig( //nolint:funlen
636636
httpPort uint,
637637
useTLS bool,
638638
postgresPort uint,
639-
dataFolder string,
640639
nhostFolder string,
641640
dotNhostFolder string,
642641
rootFolder string,
@@ -655,7 +654,6 @@ func ComposeFileFromConfig( //nolint:funlen
655654
httpPort,
656655
useTLS,
657656
postgresPort,
658-
dataFolder,
659657
nhostFolder,
660658
dotNhostFolder,
661659
rootFolder,

0 commit comments

Comments
 (0)