MCPcopy Index your code
hub / github.com/bytebase/bytebase / checkDataDir

Function checkDataDir

backend/bin/server/cmd/root.go:116–134  ·  view source on GitHub ↗

-----------------------------------Command Line Config END--------------------------------------

()

Source from the content-addressed store, hash-verified

114// -----------------------------------Command Line Config END--------------------------------------
115
116func checkDataDir() error {
117 // Clean data directory path.
118 flags.dataDir = filepath.Clean(flags.dataDir)
119
120 // Convert to absolute path if relative path is supplied.
121 if !filepath.IsAbs(flags.dataDir) {
122 absDir, err := filepath.Abs(filepath.Dir(os.Args[0]) + "/" + flags.dataDir)
123 if err != nil {
124 return err
125 }
126 flags.dataDir = absDir
127 }
128
129 if _, err := os.Stat(flags.dataDir); err != nil {
130 return errors.Wrapf(err, "unable to access --data directory %s", flags.dataDir)
131 }
132
133 return nil
134}
135
136// Check the port availability by trying to bind and immediately release it.
137func checkPort(port int) error {

Callers 1

startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected