This is a Gulp-powered build system with the following features:
- Sass compilation and prefixing
- Go compilation
- Dynamic browser reloading using BrowserSync
- For production builds:
- CSS compression
- Image compression
The project build requires:
- Go (1.7 or later)
- NodeJS (0.12 or greater, LTS version >4.0.0 recommended)
- CouchDB (1.6 or greater)
First clone the project repository. Make sure it is under the GOPATH directory, for example if your GOPATH is:
DUCK should be checked out to:
To clone the codebase, use:
git clone https://github.com/Microsoft/DUCK DUCK
Then, from the cloned directory, install the required dependencies:
cd DUCK npm install npm install -g bower npm install -g gulp bower install
Make sure Couch DB is running.
npm start to execute the build. The application will be accessible at:
To create compressed, production-ready assets, run
npm run build.
Building a Distrubution
Execute the distribution build using:
npm run distro
A binary archive will be generated in the /image directory
This project reads its configuration from the file
backend/configuration.json, environment variables and also command-line flags.
The following precendence order is used. Each item takes precedence over the item below it:
The default configuration has these values:
database: location: "http://127.0.0.1" port: 5984 name: "duck" username: "" password: "" jwtkey: "c2VjcmV0" webdir: "/src/github.com/Microsoft/DUCK/frontend/dist" rulebasedir: "/src/github.com/Microsoft/DUCK/RuleBases"
The field jwtkey is a base64 encoded string. If this field is empty, a random key will be generated.
regarding path variables
If rulebasedir or webdir have an absolute path it is used as an absolute path. If it is a relative path it will be assumed to be relative to the GOPATH environment variable if present. If GOPATH is not found, the path is assumed to be relative to the go executable.
The environment variable names are prefixed with DUCK_ and all uppercase. Fields in the database object are referenced using the
. operator, e.g.
The flags are handled in the go standard way described in https://golang.org/pkg/flag/. Main points are:
Command line flag syntax:
-flag -flag=x -flag x // non-boolean flags only
>One or two minus signs may be used; they are equivalent. The last form is not permitted for boolean flags because the meaning of the command > >`cmd -x *` > >will change if there is a file called 0, false, etc. You must use the -flag=false form to turn off a boolean flag. > >Integer flags accept 1234, 0664, 0x1234 and may be negative. Boolean flags may be: > >`1, 0, t, f, T, F, true, false, TRUE, FALSE, True, False` It is *not* possible to configure the database connection via flags.