INNER CODE UNIT · Go

ensureLogDirectory

moul/sshportal · server.go:54

func ensureLogDirectory(location string) error {
	// check for the logdir existence
	logsLocation, err := os.Stat(location)
	if err != nil {
		if os.IsNotExist(err) {
			return os.MkdirAll(location, os.ModeDir|os.FileMode(0750))
		}
		return err
	}
	if !logsLocation.IsDir() {
		return fmt.Errorf("log directory cannot be created")
	}
	return nil
}

func dbConnect(c *serverConfig, config gorm.Option) (*gorm.DB, error) {
	var dbOpen func(string) gorm.Dialector
	if c.dbDriver == "sqlite3" {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…