Skip to content

Commit

Permalink
checking path
Browse files Browse the repository at this point in the history
Signed-off-by: swatign <[email protected]>
  • Loading branch information
swatiganesh committed Feb 14, 2025
1 parent a6d7d68 commit 76ea838
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"fmt"
"log"
"os"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -101,6 +102,7 @@ func readCliParams() *serveropts.Opts {
nodesMissingRunningDefault = false
}

log.Printf("-------------------Schema Path: %s", viper.GetString("schema-path"))
return &serveropts.Opts{
Host: viper.GetString("host"),
Port: viper.GetInt("port"),
Expand Down Expand Up @@ -131,11 +133,12 @@ func readCliParams() *serveropts.Opts {
MissingNodesForDeletionRunningDefault: missingNodesForDeletionRunningDefault,
NodesMissingRunningDefault: nodesMissingRunningDefault,
},
Storage: serveropts.StorageConfig{ //Added Storage Configuration
//Added Storage Configuration
Storage: serveropts.StorageConfig{
SchemaPath: viper.GetString("schema-path"),
// URI: viper.GetString("postgresql-url"),
// DBUser: viper.GetString("postgresql-user"),
// Database: viper.GetString("postgresql-database"),
SchemaPath: viper.GetString("schema-path"),
// MaxOpenConns: viper.GetInt("postgresql-max-open-conns"),
// MaxIdleConns: viper.GetInt("postgresql-max-idle-conns"),
},
Expand All @@ -156,7 +159,7 @@ func init() {
serveCmd.Flags().String("nodemanager-address", "localhost:10120", "address of nodemanager (domain:<port>)")
serveCmd.Flags().String("config-mgmt-address", "localhost:10119", "address of config-mgmt-service (domain:<port>)")
serveCmd.Flags().String("postgresql-url", "", "PG URI (postgres://host:port)")
serveCmd.Flags().String("schema-path", "", "../../../storage/schema")
serveCmd.Flags().String("schema-path", "", "../../../storage/schema/sql")
serveCmd.Flags().String("postgresql-database", "chef_ingest_service", "PG Database name")
serveCmd.Flags().Int32("converge-history-days", 30, "Number of days to keep converge history for. A number less than or equal to 0 means data should never be deleted")
serveCmd.Flags().Int32("actions-days", 30, "Number of days to keep actions for. A number less than or equal to 0 means data should never be deleted")
Expand Down
3 changes: 3 additions & 0 deletions components/ingest-service/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ func Spawn(opts *serveropts.Opts) error {
if err != nil {
return errors.Wrapf(err, "Failed to open database with uri: %s", pgURL)
}

log.Printf("********************Schema Path: %s", opts.Storage.SchemaPath)
storageConfig := &config.Storage{
URI: pgURL,
SchemaPath: opts.Storage.SchemaPath,
//SchemaPath: "../storage/schema",
}

err = storage.RunMigrations(storageConfig) // Call the migration function
Expand Down

0 comments on commit 76ea838

Please sign in to comment.