Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:webkom/census into auth
Browse files Browse the repository at this point in the history
Conflicts:
	app.bs
	views/index.jade
  • Loading branch information
relekang committed Aug 25, 2014
2 parents 7324704 + e2d0ca7 commit a9d7d7b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 23 deletions.
4 changes: 3 additions & 1 deletion app.bs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'jade')
app.set('trust proxy', true)
app.set('abakus token', process.env.ABAKUS_TOKEN)
app.set('timedelta', 15 * 60 * 1000)

app.use(express.static(path.join(__dirname, 'public')))
app.use(logging('dev'))
Expand All @@ -28,7 +29,7 @@ app.use(cookieParser())
app.use(session({ cookie: { maxAge: 60000 }, secret: 'This is top secret'}))

if app.get('abakus token')
passport.use(passportAbakus.abakusStrategy)
passport.use(passportAbakus.abakusStrategy())
passport.serializeUser(passportAbakus.serializeAbakusUser)
passport.deserializeUser(passportAbakus.deserializeAbakusUser)

Expand All @@ -54,6 +55,7 @@ app.use((req, res, next) ->
)

app.use((err, req, res, next) ->
# istanbul ignore if
if app.get('env') == 'production'
template = 'error/production'
else
Expand Down
3 changes: 2 additions & 1 deletion dummy.bs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ./app
export {
servers: [
{
Expand All @@ -10,7 +11,7 @@ export {
hostname: 'leia.abakus.no'
username: 'abakus'
ip: '127.0.0.1'
timestamp: Date.now() - (25 * 60 * 60 * 1000)
timestamp: Date.now() - app.get('timedelta')
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"morgan": "~1.0.0",
"nib": "^1.0.3",
"passport": "^0.2.0",
"passport-abakus": "0.0.2",
"passport-abakus": "0.0.3",
"redis": "^0.12.0",
"request": "^2.36.0",
"slugify": "^0.1.0",
Expand Down
11 changes: 8 additions & 3 deletions redis.bs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import redis
export {
client: () ->
host = null
password = process.env.REDIS_PASSWORD
# istanbul ignore if
if process.env.NODE_ENV == 'production'
client = redis.createClient(6379, 'leia.abakus.no', {})
host = 'leia.abakus.no'
else
client = redis.createClient(6379, '127.0.0.1', {})
host = '127.0.0.1'

password = process.env.REDIS_PASSWORD
client = redis.createClient(6379, host, {})

# istanbul ignore if
if password
client.auth(password)
return client
Expand Down
26 changes: 19 additions & 7 deletions stylus/main.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import 'nib'

$red = #FC5B3F
$green = #6FB07F
$orange = #FCB03C
Expand All @@ -8,7 +10,7 @@ body

.container
width: 100%

.navbar
background: transparent
border: none
Expand All @@ -22,14 +24,20 @@ body
border-bottom: 2px solid #e0e0e0

.servers
text-align: center
text-align: left
max-width: 800px
margin: 0 auto

li
display: inline-block
float: none
h3
margin-bottom: 4px
.icon-container
text-align: right
height: 100px
.fa
margin-top: 15px

h3
margin-top: 0
.navbar-fixed-bottom
background: white

.red
color: $red
Expand All @@ -40,3 +48,7 @@ body

.thin
font-weight: 100

@media screen and (min-width: 768px)
.servers
column-count(2)
2 changes: 1 addition & 1 deletion test/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('GET /', () ->
if err
done(err)
expect(res.text).to.contain('green')
expect(res.text).to.contain('green')
expect(res.text).to.contain('red')
done()
)
)
Expand Down
20 changes: 11 additions & 9 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ extends layout
block content
ul.servers.list-unstyled
for server in servers
li.col-xs-12.col-sm-4.col-lg-3.text-center
if server.isOk
.fa.fa-hdd-o.fa-5x.green
else
.fa.fa-hdd-o.fa-5x.red
h3 #{server.hostname}
if authenticated
div.ip #{server.ip}
div.user #{server.username}
li.row
.icon-container.col-xs-4
if server.isOk
.fa.fa-hdd-o.fa-5x.green
else
.fa.fa-hdd-o.fa-5x.red
.col-xs-8
h3 #{server.hostname}
if authenticated
div.ip #{server.ip}
div.user #{server.username}

0 comments on commit a9d7d7b

Please sign in to comment.