unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2646305592
So I am testing the backend with the new parameters of the postgres DB and
faced this problem where the initial configuration of the database/connection
is by default loaded and therefore cannot go through the installation steps
when trying to debug the target code.
Specifically command.go (in `answer/cmd`) has this function:
```
initCmd = &cobra.Command{
Use: "init",
Short: "init answer application",
Long: `init answer application`,
Run: func(_ *cobra.Command, _ []string) {
// check config file and database. if config file exists and
database is already created, init done
cli.InstallAllInitialEnvironment(dataDirPath)
configFileExist := cli.CheckConfigFile(cli.GetConfigFilePath())
if configFileExist {
fmt.Println("config file exists, try to read the config...")
c, err := conf.ReadConfig(cli.GetConfigFilePath())
if err != nil {
fmt.Println("read config failed: ", err.Error())
return
}
fmt.Println("config file read successfully, try to connect
database...")
if cli.CheckDBTableExist(c.Data.Database) {
fmt.Println("connect to database successfully and table
already exists, do nothing.")
return
}
}
// start installation server to install
install.Run(cli.GetConfigFilePath())
},
}
```
and the configuration is always loaded as `/data/
`(`cli.GetConfigFilePath()`).
Can I know how to make `cli.GetConfigFilePath()` not return `/data/` so that
I go through the install steps, knowing that there isn't no /data/ folder in
the source (I deleted it)? that is emptying some related cache I cannot find.
PS: the cmd I am using to debug isn't `answer init -C ./data/` (this one
would launch the install steps) but one without `-C` flag
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]