From d7ed6bf7826de3b014b467a4f4b26ecd0b3dc371 Mon Sep 17 00:00:00 2001 From: MostPow3rful Date: Wed, 25 Oct 2023 17:02:40 +0330 Subject: [PATCH] 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