From d7ed6bf7826de3b014b467a4f4b26ecd0b3dc371 Mon Sep 17 00:00:00 2001 From: MostPow3rful Date: Wed, 25 Oct 2023 17:02:40 +0330 Subject: [PATCH 1/3] Config Structure Updated --- config/config.go | 19 ++++++++++++------- config/config.yaml | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 36d7d7d..386bf74 100644 --- a/config/config.go +++ b/config/config.go @@ -30,7 +30,7 @@ type Log struct { type User struct { Name string `yaml:"name"` - PassWord string `yaml:"pass_word"` + Password string `yaml:"password"` Cmds []string `yaml:"cmds"` } @@ -42,14 +42,19 @@ func (conf *Config) BasicCheck() error { } func DefaultConfig() *Config { - config := &Config{} - config.Log.Path = "ttrace.log" - config.Name = "time_trace" - config.Server.IP = "localhost" - config.Server.Port = "7070" + config := &Config{ + Server: Server{ + IP: "localhost", + Port: "7070", + }, + Log: Log{ + Path: "ttrace.log", + }, + Name: "time_trace", + } rootUser := User{ Name: "root", - PassWord: "super_secret_password", + Password: "super_secret_password", Cmds: []string{"*"}, } config.Users = append(config.Users, rootUser) diff --git a/config/config.yaml b/config/config.yaml index af2e42f..2f043b7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -9,9 +9,10 @@ log: users: - name: root - pass_word: super_secret_password + password: super_secret_password cmds: - '*' + # Also you can use this for multiple users and limited commands # users: # - name: root From 50ff1934aef3655fa4a5a23bf1e1e5d6974ba8be Mon Sep 17 00:00:00 2001 From: MostPow3rful Date: Wed, 25 Oct 2023 17:18:55 +0330 Subject: [PATCH 2/3] Code Reformated --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 386bf74..0eb46cc 100644 --- a/config/config.go +++ b/config/config.go @@ -44,7 +44,7 @@ func (conf *Config) BasicCheck() error { func DefaultConfig() *Config { config := &Config{ Server: Server{ - IP: "localhost", + IP: "localhost", Port: "7070", }, Log: Log{ From 645246b20588cc8cb2b4291b88c496647a661929 Mon Sep 17 00:00:00 2001 From: MostPow3rful Date: Wed, 25 Oct 2023 17:24:42 +0330 Subject: [PATCH 3/3] updated yaml file changed pass_word to password in comments --- config/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.yaml b/config/config.yaml index 2f043b7..c55b8c7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -16,7 +16,7 @@ users: # Also you can use this for multiple users and limited commands # users: # - name: root -# pass_word: super_secret_password +# password: super_secret_password # cmd: # - * # all commands. # - name: developer