Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

chore: config structure updated #60

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions config/config.yaml
MostPow3rful marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ 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
# pass_word: super_secret_password
# password: super_secret_password
# cmd:
# - * # all commands.
# - name: developer
Expand Down