зеркало из https://github.com/Azure/spec-sla-bot.git
Initialize Buffalo App
This commit is contained in:
Родитель
5bd1d31112
Коммит
48b5c4b9c6
|
@ -0,0 +1,21 @@
|
|||
app_root: .
|
||||
ignored_folders:
|
||||
- vendor
|
||||
- log
|
||||
- logs
|
||||
- assets
|
||||
- public
|
||||
- grifts
|
||||
- tmp
|
||||
- bin
|
||||
- node_modules
|
||||
- .sass-cache
|
||||
included_extensions:
|
||||
- .go
|
||||
- .env
|
||||
build_path: tmp
|
||||
build_delay: 200ns
|
||||
binary_name: spec-sla-bot-build
|
||||
command_flags: []
|
||||
enable_colors: true
|
||||
log_name: buffalo
|
|
@ -0,0 +1,20 @@
|
|||
engines:
|
||||
fixme:
|
||||
enabled: true
|
||||
gofmt:
|
||||
enabled: true
|
||||
golint:
|
||||
enabled: true
|
||||
govet:
|
||||
enabled: true
|
||||
exclude_paths:
|
||||
- grifts/**/*
|
||||
- "**/*_test.go"
|
||||
- "*_test.go"
|
||||
- "**_test.go"
|
||||
- logs/*
|
||||
- public/*
|
||||
- templates/*
|
||||
ratings:
|
||||
paths:
|
||||
- "**.go"
|
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
*.log
|
||||
bin/
|
|
@ -10,3 +10,17 @@
|
|||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
vendor/
|
||||
**/*.log
|
||||
**/*.sqlite
|
||||
.idea/
|
||||
bin/
|
||||
tmp/
|
||||
node_modules/
|
||||
.sass-cache/
|
||||
*-packr.go
|
||||
public/assets/
|
||||
spec_sla_bot
|
||||
.vscode/
|
||||
.grifter/
|
||||
.env
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.8.x
|
||||
|
||||
env:
|
||||
- GO_ENV=test
|
||||
|
||||
services:
|
||||
- postgresql
|
||||
|
||||
before_script:
|
||||
- psql -c 'create database spec_sla_bot_test;' -U postgres
|
||||
- mkdir -p $TRAVIS_BUILD_DIR/public/assets
|
||||
|
||||
go_import_path: github.com/Azure/spec_sla_bot
|
||||
|
||||
install:
|
||||
- go get github.com/gobuffalo/buffalo/buffalo
|
||||
- go get github.com/golang/dep/cmd/dep
|
||||
- dep ensure
|
||||
|
||||
script: buffalo test
|
|
@ -0,0 +1,30 @@
|
|||
# This is a multi-stage Dockerfile and requires >= Docker 17.05
|
||||
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
|
||||
FROM gobuffalo/buffalo:v0.11.1 as builder
|
||||
|
||||
RUN mkdir -p $GOPATH/src/github.com/Azure/spec_sla_bot
|
||||
WORKDIR $GOPATH/src/github.com/Azure/spec_sla_bot
|
||||
|
||||
ADD . .
|
||||
RUN dep ensure
|
||||
RUN buffalo build --static -o /bin/app
|
||||
|
||||
FROM alpine
|
||||
RUN apk add --no-cache bash
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
WORKDIR /bin/
|
||||
|
||||
COPY --from=builder /bin/app .
|
||||
|
||||
# Comment out to run the binary in "production" mode:
|
||||
# ENV GO_ENV=production
|
||||
|
||||
# Bind the app to 0.0.0.0 so it can be seen from outside the container
|
||||
ENV ADDR=0.0.0.0
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Comment out to run the migrations before running the binary:
|
||||
# CMD /bin/app migrate; /bin/app
|
||||
CMD exec /bin/app
|
|
@ -0,0 +1,489 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "dmitri.shuralyov.com/text/kebabcase"
|
||||
packages = ["."]
|
||||
revision = "40e40b42552a9cb37d6e98f4ad31f63ae53ea43a"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
packages = ["."]
|
||||
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/ajg/form"
|
||||
packages = ["."]
|
||||
revision = "cc2954064ec9ea8d93917f0f87456e11d7b881ad"
|
||||
version = "v1.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/cockroachdb/cockroach-go"
|
||||
packages = ["crdb"]
|
||||
revision = "59c0560478b705bf9bd12f9252224a0fad7c87df"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/dustin/go-humanize"
|
||||
packages = ["."]
|
||||
revision = "02af3965c54e8cacf948b97fef38925c4120652c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fatih/color"
|
||||
packages = ["."]
|
||||
revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
|
||||
version = "v1.7.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fatih/structs"
|
||||
packages = ["."]
|
||||
revision = "a720dfa8df582c51dee1b36feabb906bde1588bd"
|
||||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fsnotify/fsnotify"
|
||||
packages = ["."]
|
||||
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
|
||||
version = "v1.4.7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/go-sql-driver/mysql"
|
||||
packages = ["."]
|
||||
revision = "d523deb1b23d913de5bdada721a6071e71283618"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/buffalo"
|
||||
packages = [
|
||||
".",
|
||||
"binding",
|
||||
"middleware",
|
||||
"middleware/csrf",
|
||||
"middleware/ssl",
|
||||
"render",
|
||||
"worker"
|
||||
]
|
||||
revision = "354657dfd81584bb82b8b6dff9bb9f6ab22712a8"
|
||||
version = "v0.11.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/envy"
|
||||
packages = ["."]
|
||||
revision = "ef60bfc50c8f92d1ee64674d8ce7a48f1f67625e"
|
||||
version = "v1.6.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/makr"
|
||||
packages = ["."]
|
||||
revision = "2f752af1831478b8c496635cb46b947811097061"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/packr"
|
||||
packages = ["."]
|
||||
revision = "7f4074995d431987caaa35088199f13c44b24440"
|
||||
version = "v1.11.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/plush"
|
||||
packages = [
|
||||
".",
|
||||
"ast",
|
||||
"lexer",
|
||||
"parser",
|
||||
"token"
|
||||
]
|
||||
revision = "5d52aed81c89f76ec6f19a03537c85773102ebf4"
|
||||
version = "v3.7.3"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/pop"
|
||||
packages = [
|
||||
".",
|
||||
"associations",
|
||||
"columns",
|
||||
"fizz",
|
||||
"fizz/translators",
|
||||
"nulls"
|
||||
]
|
||||
revision = "9985012f32f5e36b1a10e9191ee460daac4a9bc7"
|
||||
version = "v4.5.9"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/suite"
|
||||
packages = [
|
||||
".",
|
||||
"fix"
|
||||
]
|
||||
revision = "e2e0134eb87394466461f262c7cb7027b9e332e0"
|
||||
version = "v2.1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/tags"
|
||||
packages = [
|
||||
".",
|
||||
"form",
|
||||
"form/bootstrap"
|
||||
]
|
||||
revision = "82cd7696c84aba829b74e81814ff489b64e7b56a"
|
||||
version = "v2.0.5"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/uuid"
|
||||
packages = ["."]
|
||||
revision = "3a9fb6c5c481d4886f1e9323c61ad743fb955860"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/validate"
|
||||
packages = [
|
||||
".",
|
||||
"validators"
|
||||
]
|
||||
revision = "42d8db6e06e617cdedcc7a849d6690a2cb5a8d28"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/gobuffalo/x"
|
||||
packages = [
|
||||
"httpx",
|
||||
"sessions"
|
||||
]
|
||||
revision = "11ca13c05abd73167c56ed10f8874c7c7497f759"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/context"
|
||||
packages = ["."]
|
||||
revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/mux"
|
||||
packages = ["."]
|
||||
revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
|
||||
version = "v1.6.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/securecookie"
|
||||
packages = ["."]
|
||||
revision = "e59506cc896acb7f7bf732d4fdf5e25f7ccd8983"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/sessions"
|
||||
packages = ["."]
|
||||
revision = "ca9ada44574153444b00d3fd9c8559e4cc95f896"
|
||||
version = "v1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gorilla/websocket"
|
||||
packages = ["."]
|
||||
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/jmoiron/sqlx"
|
||||
packages = [
|
||||
".",
|
||||
"reflectx"
|
||||
]
|
||||
revision = "2aeb6a910c2b94f2d5eb53d9895d80e27264ec41"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/joho/godotenv"
|
||||
packages = ["."]
|
||||
revision = "a79fa1e548e2c689c241d10173efd51e5d689d5b"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/lib/pq"
|
||||
packages = [
|
||||
".",
|
||||
"oid"
|
||||
]
|
||||
revision = "90697d60dd844d5ef6ff15135d0203f65d2f53b8"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/going"
|
||||
packages = [
|
||||
"defaults",
|
||||
"randx",
|
||||
"wait"
|
||||
]
|
||||
revision = "0576708c56cea02331f864fe6e157ac7841923e4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/grift"
|
||||
packages = ["grift"]
|
||||
revision = "76f93617a788d350124f749acb3790276a436cc0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/hmax"
|
||||
packages = ["."]
|
||||
revision = "800e180dcd16937a4cc134c6aa8c8407e62ce880"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/inflect"
|
||||
packages = ["."]
|
||||
revision = "dd7de90c06bca70f18136e59dec2270c19a401e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/markbates/refresh"
|
||||
packages = [
|
||||
"refresh",
|
||||
"refresh/web"
|
||||
]
|
||||
revision = "fab0ab1230a5772b04f3b736821822935b5a5279"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/markbates/sigtx"
|
||||
packages = ["."]
|
||||
revision = "daa2e5f08161c569ca3d938d70750ccd038daf16"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/willie"
|
||||
packages = ["."]
|
||||
revision = "67934945178ed6f7799c3a001e2dde57315558c2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/anko"
|
||||
packages = [
|
||||
"ast",
|
||||
"core",
|
||||
"parser",
|
||||
"vm"
|
||||
]
|
||||
revision = "e9c5c0ca86cf129292c56ddbddc4fff027844d65"
|
||||
version = "v0.0.4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-colorable"
|
||||
packages = ["."]
|
||||
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
|
||||
version = "v0.0.9"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-sqlite3"
|
||||
packages = ["."]
|
||||
revision = "323a32be5a2421b8c7087225079c6c900ec397cd"
|
||||
version = "v1.7.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/microcosm-cc/bluemonday"
|
||||
packages = ["."]
|
||||
revision = "995366fdf961d03629cd17361bddd32745718e2c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/go-homedir"
|
||||
packages = ["."]
|
||||
revision = "3864e76763d94a6df2f9960b16a20a33da9f9a66"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/monoculum/formam"
|
||||
packages = ["."]
|
||||
revision = "99ca9dcbaca6d91e9665f817d0da23af6184ced3"
|
||||
version = "v3.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/rs/cors"
|
||||
packages = ["."]
|
||||
revision = "ca016a06a5753f8ba03029c0aa5e54afb1bf713f"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/russross/blackfriday"
|
||||
packages = ["."]
|
||||
revision = "11635eb403ff09dbc3a6b5a007ab5ab09151c229"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/serenize/snaker"
|
||||
packages = ["."]
|
||||
revision = "a683aaf2d516deecd70cad0c72e3ca773ecfcef0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sergi/go-diff"
|
||||
packages = ["diffmatchpatch"]
|
||||
revision = "1744e2970ca51c86172c8190fadad617561ed6e7"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/github_flavored_markdown"
|
||||
packages = ["."]
|
||||
revision = "8913699a52e3aa02aa96387098e0004bb84aacf0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/go"
|
||||
packages = [
|
||||
"parserutil",
|
||||
"printerutil",
|
||||
"reflectfind",
|
||||
"reflectsource"
|
||||
]
|
||||
revision = "9e1955d9fb6e1ee2345ba1f5e71669263e719e27"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/go-goon"
|
||||
packages = ["."]
|
||||
revision = "37c2f522c041b74919a9e5e3a6c5c47eb34730a5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/graphql"
|
||||
packages = ["ident"]
|
||||
revision = "62c9ce094e75302d560f7adcdf16c06d05aaa958"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/highlight_diff"
|
||||
packages = ["."]
|
||||
revision = "09bb4053de1b1d872a9f25dc21378fa71dca4e4e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/highlight_go"
|
||||
packages = ["."]
|
||||
revision = "78fb10f4a5f89e812a5e26ab723b954a51226086"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/octicon"
|
||||
packages = ["."]
|
||||
revision = "c42b0e3b24d96976ecac81ef691662777b39ef64"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/sanitized_anchor_name"
|
||||
packages = ["."]
|
||||
revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
|
||||
version = "v1.0.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/sourcegraph/annotate"
|
||||
packages = ["."]
|
||||
revision = "f4cad6c6324d3f584e1743d8b3e0e017a5f3a636"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/sourcegraph/syntaxhighlight"
|
||||
packages = ["."]
|
||||
revision = "bd320f5d308e1a3c4314c678d8227a0d72574ae7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = [
|
||||
"assert",
|
||||
"require",
|
||||
"suite"
|
||||
]
|
||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
||||
version = "v1.2.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/unrolled/secure"
|
||||
packages = ["."]
|
||||
revision = "a1cf62cc2159fff407728f118c41aece76c397fa"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"bcrypt",
|
||||
"blowfish",
|
||||
"ssh/terminal"
|
||||
]
|
||||
revision = "df8d4716b3472e4a531c33cedbe537dae921a1a9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"html",
|
||||
"html/atom"
|
||||
]
|
||||
revision = "1e491301e022f8f977054da4c2d852decd59571f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["errgroup"]
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "c11f84a56e43e20a78cee75a7c034031ecf57d1f"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/appengine"
|
||||
packages = ["cloudsql"]
|
||||
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
|
||||
version = "v2.2.1"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "69ab6d89dfe5ea06776909f1548948a1e9b3384a223aaf517c6e128f6d6e8afb"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
|
@ -0,0 +1,62 @@
|
|||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gobuffalo/buffalo"
|
||||
version = "0.11.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gobuffalo/envy"
|
||||
version = "1.6.2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gobuffalo/pop"
|
||||
version = "4.5.9"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gobuffalo/suite"
|
||||
version = "2.1.1"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/gobuffalo/x"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/markbates/grift"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/rs/cors"
|
||||
version = "1.4.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/unrolled/secure"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
34
README.md
34
README.md
|
@ -1,3 +1,37 @@
|
|||
# Welcome to Buffalo!
|
||||
|
||||
Thank you for choosing Buffalo for your web development needs.
|
||||
|
||||
## Database Setup
|
||||
|
||||
It looks like you chose to set up your application using a postgres database! Fantastic!
|
||||
|
||||
The first thing you need to do is open up the "database.yml" file and edit it to use the correct usernames, passwords, hosts, etc... that are appropriate for your environment.
|
||||
|
||||
You will also need to make sure that **you** start/install the database of your choice. Buffalo **won't** install and start postgres for you.
|
||||
|
||||
### Create Your Databases
|
||||
|
||||
Ok, so you've edited the "database.yml" file and started postgres, now Buffalo can create the databases in that file for you:
|
||||
|
||||
$ buffalo db create -a
|
||||
## Starting the Application
|
||||
|
||||
Buffalo ships with a command that will watch your application and automatically rebuild the Go binary and any assets for you. To do that run the "buffalo dev" command:
|
||||
|
||||
$ buffalo dev
|
||||
|
||||
If you point your browser to [http://127.0.0.1:3000](http://127.0.0.1:3000) you should see a "Welcome to Buffalo!" page.
|
||||
|
||||
**Congratulations!** You now have your Buffalo application up and running.
|
||||
|
||||
## What Next?
|
||||
|
||||
We recommend you heading over to [http://gobuffalo.io](http://gobuffalo.io) and reviewing all of the great documentation there.
|
||||
|
||||
Good luck!
|
||||
|
||||
[Powered by Buffalo](http://gobuffalo.io)
|
||||
|
||||
# Contributing
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package actions
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gobuffalo/suite"
|
||||
)
|
||||
|
||||
type ActionSuite struct {
|
||||
*suite.Action
|
||||
}
|
||||
|
||||
func Test_ActionSuite(t *testing.T) {
|
||||
as := &ActionSuite{suite.NewAction(App())}
|
||||
suite.Run(t, as)
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package actions
|
||||
|
||||
import (
|
||||
"github.com/gobuffalo/buffalo"
|
||||
"github.com/gobuffalo/buffalo/middleware"
|
||||
"github.com/gobuffalo/buffalo/middleware/ssl"
|
||||
"github.com/gobuffalo/envy"
|
||||
"github.com/unrolled/secure"
|
||||
|
||||
"github.com/Azure/spec_sla_bot/models"
|
||||
"github.com/gobuffalo/x/sessions"
|
||||
"github.com/rs/cors"
|
||||
)
|
||||
|
||||
// ENV is used to help switch settings based on where the
|
||||
// application is being run. Default is "development".
|
||||
var ENV = envy.Get("GO_ENV", "development")
|
||||
var app *buffalo.App
|
||||
|
||||
// App is where all routes and middleware for buffalo
|
||||
// should be defined. This is the nerve center of your
|
||||
// application.
|
||||
func App() *buffalo.App {
|
||||
if app == nil {
|
||||
app = buffalo.New(buffalo.Options{
|
||||
Env: ENV,
|
||||
SessionStore: sessions.Null{},
|
||||
PreWares: []buffalo.PreWare{
|
||||
cors.Default().Handler,
|
||||
},
|
||||
SessionName: "_spec_sla_bot_session",
|
||||
})
|
||||
// Automatically redirect to SSL
|
||||
app.Use(ssl.ForceSSL(secure.Options{
|
||||
SSLRedirect: ENV == "production",
|
||||
SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
|
||||
}))
|
||||
|
||||
// Set the request content type to JSON
|
||||
app.Use(middleware.SetContentType("application/json"))
|
||||
|
||||
if ENV == "development" {
|
||||
app.Use(middleware.ParameterLogger)
|
||||
}
|
||||
|
||||
// Wraps each request in a transaction.
|
||||
// c.Value("tx").(*pop.PopTransaction)
|
||||
// Remove to disable this.
|
||||
app.Use(middleware.PopTransaction(models.DB))
|
||||
|
||||
app.GET("/", HomeHandler)
|
||||
|
||||
}
|
||||
|
||||
return app
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package actions
|
||||
|
||||
import "github.com/gobuffalo/buffalo"
|
||||
|
||||
// HomeHandler is a default handler to serve up
|
||||
// a home page.
|
||||
func HomeHandler(c buffalo.Context) error {
|
||||
return c.Render(200, r.JSON(map[string]string{"message": "Welcome to Buffalo!"}))
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package actions
|
||||
|
||||
func (as *ActionSuite) Test_HomeHandler() {
|
||||
res := as.JSON("/").Get()
|
||||
as.Equal(200, res.Code)
|
||||
as.Contains(res.Body.String(), "Welcome to Buffalo")
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package actions
|
||||
|
||||
import (
|
||||
"github.com/gobuffalo/buffalo/render"
|
||||
)
|
||||
|
||||
var r *render.Engine
|
||||
|
||||
func init() {
|
||||
r = render.New(render.Options{})
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
development:
|
||||
dialect: postgres
|
||||
database: spec_sla_bot_development
|
||||
user: postgres
|
||||
password: postgres
|
||||
host: 127.0.0.1
|
||||
pool: 5
|
||||
|
||||
test:
|
||||
url: {{envOr "TEST_DATABASE_URL" "postgres://postgres:postgres@127.0.0.1:5432/spec_sla_bot_test?sslmode=disable"}}
|
||||
|
||||
production:
|
||||
url: {{envOr "DATABASE_URL" "postgres://postgres:postgres@127.0.0.1:5432/spec_sla_bot_production?sslmode=disable"}}
|
|
@ -0,0 +1,15 @@
|
|||
package grifts
|
||||
|
||||
import (
|
||||
"github.com/markbates/grift/grift"
|
||||
)
|
||||
|
||||
var _ = grift.Namespace("db", func() {
|
||||
|
||||
grift.Desc("seed", "Seeds a database")
|
||||
grift.Add("seed", func(c *grift.Context) error {
|
||||
// Add DB seeding stuff here
|
||||
return nil
|
||||
})
|
||||
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
package grifts
|
||||
|
||||
import (
|
||||
"github.com/Azure/spec_sla_bot/actions"
|
||||
"github.com/gobuffalo/buffalo"
|
||||
)
|
||||
|
||||
func init() {
|
||||
buffalo.Grifts(actions.App())
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"singular": "plural"
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/Azure/spec_sla_bot/actions"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := actions.App()
|
||||
if err := app.Serve(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/gobuffalo/envy"
|
||||
"github.com/gobuffalo/pop"
|
||||
)
|
||||
|
||||
// DB is a connection to your database to be used
|
||||
// throughout your application.
|
||||
var DB *pop.Connection
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
env := envy.Get("GO_ENV", "development")
|
||||
DB, err = pop.Connect(env)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
pop.Debug = env == "development"
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package models_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gobuffalo/suite"
|
||||
)
|
||||
|
||||
type ModelSuite struct {
|
||||
*suite.Model
|
||||
}
|
||||
|
||||
func Test_ModelSuite(t *testing.T) {
|
||||
as := &ModelSuite{suite.NewModel()}
|
||||
suite.Run(t, as)
|
||||
}
|
Загрузка…
Ссылка в новой задаче