Skip to content

Simple and lightweight Apache2 Config Detector and Parser

License

Notifications You must be signed in to change notification settings

melvin-v-w/go-apachetizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-apachetizer

Simple and lightweight Apache2 Config Detector and Parser

Used external Dependencies

  • none

Docs

All code examples are not handling any errors please keep that in mind

VHostConfDetector(cfgPath string)

This function will detect all configs save it into a
[]string array and returns the []string

package main

import(
	"github.com/dbzmelvin/go-apachetizer"
	"fmt"
	)

func main(){
	list, _ :=  apachetizer.VHostConfDetector("./etc/apache2/sites-available")
	fmt.Printf("This is your list: %s", list)
}
VHostConfParser(file io.Reader)

This function will parse the given config file, you have to pass an io.Reader

package main

import(
	"github.com/dbzmelvin/go-apachetizer"
	"fmt"
	"os"
	"encoding/json"
	)

func main(){
    Reader, _ := os.Open("./etc/apache2/testconfig-le-ssl.conf") //io.Reader
    config, _ := apachetizer.VHostConfParser(Reader) //Parse the config
    jsonEncoded, _ := json.Marshal(config) //Encode the []string array to json []byte array
    fmt.Println(string(jsonEncoded)) //Print the []byte array as string
}

License

License: CC BY 4.0

About

Simple and lightweight Apache2 Config Detector and Parser

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages