Skip to content

Commit 05a315f

Browse files
committed
small
1 parent c2fc7fc commit 05a315f

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

cmd/start.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ var startCmd = &cobra.Command{
2020
func runStart(cmd *cobra.Command, args []string) error {
2121
// Check if config is loaded
2222
if config == nil {
23-
return fmt.Errorf("failed to load config: dbos-config.yaml not found")
23+
return fmt.Errorf("no config provided")
2424
}
2525

2626
if len(config.RuntimeConfig.Start) == 0 {
27-
return fmt.Errorf("no start commands found in 'dbos-config.yaml'")
27+
return fmt.Errorf("no start commands found in config file")
2828
}
2929

30-
logger.Info("Executing start commands from 'dbos-config.yaml'")
30+
logger.Info("Executing start commands from config file")
3131

3232
for _, command := range config.RuntimeConfig.Start {
3333
logger.Info("Executing command", "command", command)
@@ -74,14 +74,14 @@ func runStart(cmd *cobra.Command, args []string) error {
7474
}
7575
case sig := <-sigChan:
7676
logger.Info("Received signal, stopping...", "signal", sig)
77-
77+
7878
// Kill the process group on Unix-like systems
7979
if runtime.GOOS != "windows" {
8080
syscall.Kill(-process.Process.Pid, syscall.SIGTERM)
8181
} else {
8282
process.Process.Kill()
8383
}
84-
84+
8585
// Wait a bit for graceful shutdown
8686
select {
8787
case <-done:
@@ -91,10 +91,10 @@ func runStart(cmd *cobra.Command, args []string) error {
9191
syscall.Kill(-process.Process.Pid, syscall.SIGKILL)
9292
}
9393
}
94-
94+
9595
os.Exit(0)
9696
}
9797
}
9898

9999
return nil
100-
}
100+
}

cmd/utils.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func maskPassword(dbURL string) string {
1616
parsedURL, err := url.Parse(dbURL)
1717
if err != nil {
1818
// If we can't parse it, return the original (shouldn't happen with valid URLs)
19+
logger.Warn("Failed to parse database URL", "error", err)
1920
return dbURL
2021
}
2122

@@ -57,7 +58,7 @@ func getDBURL(_ *cobra.Command) (string, error) {
5758
resolvedURL = envURL
5859
source = "environment variable"
5960
} else {
60-
return "", fmt.Errorf("missing database URL: please set it using the --db-url flag, the DBOS_SYSTEM_DATABASE_URL environment variable, or in your dbos-config.yaml file")
61+
return "", fmt.Errorf("missing database URL: please set it using the --db-url flag, your dbos-config.yaml file, or the DBOS_SYSTEM_DATABASE_URL environment variable")
6162
}
6263

6364
// Log the database URL in verbose mode with masked password
@@ -71,12 +72,7 @@ func getDBURL(_ *cobra.Command) (string, error) {
7172

7273
// createDBOSContext creates a new DBOS context with the provided database URL
7374
func createDBOSContext(dbURL string) (dbos.DBOSContext, error) {
74-
// TODO consider removing the CLI flag app-name entirely?
7575
appName := "dbos-cli"
76-
if viper.IsSet("name") {
77-
appName = viper.GetString("name")
78-
}
79-
8076
ctx, err := dbos.NewDBOSContext(dbos.Config{
8177
DatabaseURL: dbURL,
8278
AppName: appName,

0 commit comments

Comments
 (0)