This is code in Golang that will read a csv file and generate updated markdown files to be displayed on https://github.com/infosecstreams/infosecstreams.github.io/
Check the Makefile
for all options but you've got make {docs,test,cover,clean,build,docker-build,docker-run}
available to you.
When running docker-run
, we assume you're providing streamers.csv
from the infosecstreams repo. You can check the invocation of the docker run ...
command in the Makefile for further details.
When developing, you'll likely not want to actually hit the API and use the internet. Instead you can reference static json files.
If the SECINFO_TEST
environment variable is set (to literally any non-empty string), we'll use the test files instead of hitting the API.
// Check environ SECINFO_TEST exists
if os.Getenv("SECINFO_TEST") == "" { ... }
else {
// Read active.json into active struct
f, _ := ioutil.ReadFile("active.json")
_ = json.Unmarshal([]byte(f), &active)
// Read inactive.json into inactive struct
f, _ = ioutil.ReadFile("inactive.json")
_ = json.Unmarshal([]byte(f), &inactive)
}
Ensure there's a streamers.csv
in the CWD of the secinfo binary.
You can optionally provide an existing index.md file to be updated
The tool should do its best to main the online/offline status during the update.
This is ideally ran in the infosecstreams repo as part of a time-based GitHub Actions workflow. That workflow should run that docker container generated by this repo.