diff --git a/README.md b/README.md index c077bef..d308223 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,18 @@ ## Powr -Web UI frontend for PowerDNS API interface +Web UI frontend for PowerDNS API interface. + +The project's aims are: +- simplicity: cover the basic operations that most people use +- easy of installation: There are no 3rd party dependencies - everything required is bundled in the release package. + +Powr is made up of browser-based Javascript (written in AngularJS) and a proxy/webserver backend (written in Go) which a) serves the static content b) proxies the API requests to/from PowerDNS backend. The `powr` server is available as a pre-compiled binary for Linux amd64 so no compilation is required. ***Work in progress - Use at your own risk*** -Current features: +### Features + +Currently supported DNS operations: - view, add zones - view, add, delete, edit zone records @@ -13,26 +21,35 @@ Current features: View a live demo at [http://porjo.github.io/powr](http://porjo.github.io/powr) -The demo uses a mock backend. +The demo runs entirely in your browser, and uses a mock backend. -### Web Server +### Usage -PowerDNS authoratative server versions prior to v3.4.2 do not support CORS which means that browser-based Javascript cannot talk directly to it. Powr includes a simple web server to a) server static files b) proxy JSON API requests to PowerDNS backend. +1. Configure your PowerDNS server to enable the API. For the authoratative server, that means adding the following to your `pdns.conf`: +``` +experimental-json-interface=yes +webserver=yes +webserver-address=0.0.0.0 +experimental-api-key=changeme +``` -### Usage +Consult the PowerDNS [documentation](http://doc.powerdns.com/md/httpapi/README/) for more information. -Grab a [current build](https://github.com/porjo/powr/releases) and untar it somewhere convenient. +2. Grab a [current build](https://github.com/porjo/powr/releases) and unpack the HTML files and proxy/webserver somewhere convenient. -Run the web server like so: +3. Run the proxy/webserver like so: ``` ./powr -d dist/ -pdnsAPIKey=changeme -pdnsHost=myserver -pdnsPort=8081 ``` -Point your browser to `http://localhost:8080` +4. Point your browser to `http://localhost:8080` (or whatever IP/hostname your server has) + +*That's it!* ### Development -1. Clone this repo somewhere convenient:`git clone https://github.com/porjo/powr.git .` +1. Clone this repo somewhere convenient: `git clone https://github.com/porjo/powr.git .` 1. Pull the necessary dependencies using npm and bower e.g. `npm install` + `bower install` -1. Build the html/css/js with `grunt build-dist`. Static content is located under `/dist` 1. Build the `powr` webserver binary with `go build` +1. Run `grunt-watch` to automatically populate the contents of `/dist` anytime a change is made +1. Edit AngularJS project files under `/src` diff --git a/package.json b/package.json index d71bc1d..cd8bc4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powr", - "version": "0.2.0", + "version": "0.3.0", "description": "PowerDNS API Frontend", "main": "src/app.js", "devDependencies": { diff --git a/powr.go b/powr.go index 96a9105..2ba0cf1 100644 --- a/powr.go +++ b/powr.go @@ -223,7 +223,7 @@ func (sr *html5mode) WriteHeader(status int) { func (p *pdnsBackend) Setup() { p.Director = func(req *http.Request) { - req.Header.Set("X-API-Key", pdns.Key) + req.Header.Set("X-API-Key", p.Key) req.Host = p.Host req.URL.Scheme = "http" req.URL.Host = fmt.Sprintf("%s:%d", p.Host, p.Port)