-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge branch 'main' of github.com:songquanpeng/gin-react-template
- Loading branch information
Showing
30 changed files
with
861 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package common | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
var ( | ||
Port = flag.Int("port", 3000, "the listening port") | ||
PrintVersion = flag.Bool("version", false, "print version and exit") | ||
//Host = flag.String("host", "localhost", "the server's ip address or domain") | ||
//Path = flag.String("path", "", "specify a local path to public") | ||
//VideoPath = flag.String("video", "", "specify a video folder to public") | ||
//NoBrowser = flag.Bool("no-browser", false, "open browser or not") | ||
) | ||
|
||
// UploadPath Maybe override by ENV_VAR | ||
var UploadPath = "upload" | ||
|
||
//var ExplorerRootPath = UploadPath | ||
//var ImageUploadPath = "upload/images" | ||
//var VideoServePath = "upload" | ||
|
||
func init() { | ||
flag.Parse() | ||
|
||
if *PrintVersion { | ||
fmt.Println(Version) | ||
os.Exit(0) | ||
} | ||
|
||
if os.Getenv("SESSION_SECRET") != "" { | ||
SessionSecret = os.Getenv("SESSION_SECRET") | ||
} | ||
if os.Getenv("SQLITE_PATH") != "" { | ||
SQLitePath = os.Getenv("SQLITE_PATH") | ||
} | ||
if os.Getenv("UPLOAD_PATH") != "" { | ||
UploadPath = os.Getenv("UPLOAD_PATH") | ||
//ExplorerRootPath = UploadPath | ||
//ImageUploadPath = path.Join(UploadPath, "images") | ||
//VideoServePath = UploadPath | ||
} | ||
//if *Path != "" { | ||
// ExplorerRootPath = *Path | ||
//} | ||
//if *VideoPath != "" { | ||
// VideoServePath = *VideoPath | ||
//} | ||
// | ||
//ExplorerRootPath, _ = filepath.Abs(ExplorerRootPath) | ||
//VideoServePath, _ = filepath.Abs(VideoServePath) | ||
//ImageUploadPath, _ = filepath.Abs(ImageUploadPath) | ||
// | ||
if _, err := os.Stat(UploadPath); os.IsNotExist(err) { | ||
_ = os.Mkdir(UploadPath, 0777) | ||
} | ||
//if _, err := os.Stat(ImageUploadPath); os.IsNotExist(err) { | ||
// _ = os.Mkdir(ImageUploadPath, 0777) | ||
//} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package common | ||
|
||
import "github.com/go-playground/validator/v10" | ||
|
||
var Validate *validator.Validate | ||
|
||
func init() { | ||
Validate = validator.New() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.