diff --git a/conf/wide.go b/conf/wide.go index 3e35d2e..58cf533 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -87,9 +87,9 @@ var Users []*User var Docker bool // Load loads the Wide configurations from wide.json and users' configurations from users/{username}.json. -func Load(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, confPlayground string, confUsersWorkspaces string) { +func Load(confPath, confUsers, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, confPlayground string, confUsersWorkspaces string) { initWide(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel, confPlayground, confUsersWorkspaces) - initUsers() + initUsers(confUsers) cmd := exec.Command("docker", "version") _, err := cmd.CombinedOutput() @@ -98,8 +98,8 @@ func Load(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer } } -func initUsers() { - f, err := os.Open("conf/users") +func initUsers(confUsers string) { + f, err := os.Open(confUsers) if nil != err { logger.Error(err) @@ -278,7 +278,7 @@ func FixedTimeCheckEnv() { checkEnv() // check immediately go func() { - for _ = range time.Tick(time.Minute * 7) { + for _ = range time.Tick(time.Minute*7) { checkEnv() } }() diff --git a/main.go b/main.go index 4a4b6fd..3a5ac61 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ var logger *log.Logger // The only one init function in Wide. func init() { confPath := flag.String("conf", "conf/wide.json", "path of wide.json") + confUsers := flag.String("users", "conf/users", "path of users") confIP := flag.String("ip", "", "this will overwrite Wide.IP if specified") confPort := flag.String("port", "", "this will overwrite Wide.Port if specified") confServer := flag.String("server", "", "this will overwrite Wide.Server if specified") @@ -65,16 +66,16 @@ func init() { log.SetLevel("warn") logger = log.NewLogger(os.Stdout) - wd := util.OS.Pwd() - if strings.HasPrefix(wd, os.TempDir()) { - logger.Error("Don't run Wide in OS' temp directory or with `go run`") - - os.Exit(-1) - } + //wd := util.OS.Pwd() + //if strings.HasPrefix(wd, os.TempDir()) { + // logger.Error("Don't run Wide in OS' temp directory or with `go run`") + // + // os.Exit(-1) + //} i18n.Load() event.Load() - conf.Load(*confPath, *confIP, *confPort, *confServer, *confLogLevel, *confStaticServer, *confContext, *confChannel, *confPlayground, *confUsersWorkspaces) + conf.Load(*confPath, *confUsers, *confIP, *confPort, *confServer, *confLogLevel, *confStaticServer, *confContext, *confChannel, *confPlayground, *confUsersWorkspaces) conf.FixedTimeCheckEnv() session.FixedTimeSave() @@ -84,8 +85,7 @@ func init() { session.FixedTimeReport() } - logger.Debug("host ["+runtime.Version()+", "+runtime.GOOS+"_"+runtime.GOARCH+"], cross-compilation ", - util.Go.GetCrossPlatforms()) + logger.Debug("host ["+runtime.Version()+", "+runtime.GOOS+"_"+runtime.GOARCH+"], cross-compilation ", util.Go.GetCrossPlatforms()) } // Main.