added generate.go, added todo

Added generate.go out of habit for idiots like me who delete config
files like it's no big deal. Also added a markdown file called todo,
name is self-explanatory as it helps me remember stuff that I need
to do and as well helps contributors figure what needs to happen
This commit is contained in:
Wyatt J. Miller 2019-09-25 23:17:38 -04:00
parent 854270f99c
commit e766f580bb
4 changed files with 57 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ config.yaml
vendor/ vendor/
*.log *.log
*.tar.gz *.tar.gz
*.bak

View File

@ -11,6 +11,7 @@ type Configuration struct {
Password string Password string
Port int Port int
Hosts []string Hosts []string
Logs []string
} }
func initializeConfig(filename string) Configuration { func initializeConfig(filename string) Configuration {

View File

@ -1,5 +1,52 @@
package main package main
// this file is for generating the config if it doesn't exist import (
"fmt"
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
)
// this file is for generating the config if it doesn't exist, mainly for the idiots like me :)
// this is not really a priority right now so it sitting in the backburner as you read this // this is not really a priority right now so it sitting in the backburner as you read this
// signed Wyatt J. Miller, the awesome guy who doesn't generate configs *thumbs up* // signed Wyatt J. Miller, the awesome guy who doesn't generate configs *thumbs up*
var config string = "config.yaml"
func doesConfigExist() bool {
_, err := os.Stat(config)
if err != nil {
return false
} else {
return true
}
}
func createTemplateConfig(result bool) {
if result == false {
os.Create(config)
} else {
fmt.Println()
}
}
func writeTemplateConfig(filename string) {
file := []byte(filename)
_ = ioutil.WriteFile("config.yaml", file, 0600)
config := Configuration{}
_, err := yaml.Marshal(config)
if err != nil {
panic(err)
}
fmt.Println("Template for logman's configuration complete!")
fmt.Println("")
fmt.Println("Fill in the necessary credentials you need. If")
fmt.Println("you need assitance, check out the wiki for more.")
os.Exit(0)
}

6
todo.md Normal file
View File

@ -0,0 +1,6 @@
## Things I got to do for the project
- Have config file dictate what log file you want
- Allow having SSH keys and passwordless SSH sessions, along with having bypassing keys altogether
- Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?)
- Allow different machines to collect different log files
- Allow to gather directories of log files