Nginx Go Crossplane

A library for working with NGINX configs in Go
Alternatives To Nginx Go Crossplane
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Efs270
2 years ago4September 05, 20216mitGo
A dead-simple configuration management tool powered by stupid shell scripts.
Nixops Tutorial45
3 years agootherNix
Tutorial for practical deployments with NixOps
Nginx Go Crossplane10
a month ago2apache-2.0Go
A library for working with NGINX configs in Go
Playing With Playbooks4
5 months agoJinja
A repo to test out deploying Nginx using Ansible.
Ngx3
5 years ago5mitJavaScript
Data-driven nginx configuration manager.
One And Done3
6 years ago1Python
practicing configuration management
Ansible Flask Gunicorn Nginx2
5 years agon,ullPython
Structure for Ansible infrastructure geared to deploy Flask app to
Community Share Ansible2
4 years agoShell
Ansible configuration management for Community Share
Alternatives To Nginx Go Crossplane
Select To Compare


Alternative Project Comparisons
Readme

nginx-go-crossplane

A Go port of the NGINX config/JSON converter crossplane.

Parse

This is an example that takes a path to an NGINX config file, converts it to JSON, and prints the result to stdout.

package main

import (
	"encoding/json"
	"fmt"
	"os"

	"github.com/nginxinc/nginx-go-crossplane"
)

func main() {
	path := os.Args[1]

	payload, err := crossplane.Parse(path, &crossplane.ParseOptions{})
	if err != nil {
		panic(err)
	}

	b, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(b))
}

Build

This is an example that takes a path to a JSON file, converts it to an NGINX config, and prints the result to stdout.

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"

	"github.com/nginxinc/nginx-go-crossplane"
)

func main() {
	path := os.Args[1]

	file, err := os.Open(path)
	if err != nil {
		panic(err)
	}

	content, err := ioutil.ReadAll(file)
	if err != nil {
		panic(err)
	}

	var payload crossplane.Payload
	if err = json.Unmarshal(content, &payload); err != nil {
		panic(err)
	}

	var buf bytes.Buffer
	if err = crossplane.Build(&buf, payload.Config[0], &crossplane.BuildOptions{}); err != nil {
		panic(err)
	}

	fmt.Println(buf.String())
}

Contributing

If you'd like to contribute to the project, please read our Contributing guide.

License

Apache License, Version 2.0

© F5 Networks, Inc. 2022

Popular Nginx Projects
Popular Configuration Management Projects
Popular Web Servers Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Golang
Nginx
Configuration Management