Compare commits

..

9 commits

Author SHA1 Message Date
8f3faed11f package: Release new version
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-04-01 10:05:49 +00:00
95e94b38cc server: Change log level from debug to info on normal requests
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-04-01 10:04:59 +00:00
562ade9763 Trigger new version
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-30 22:05:28 +00:00
5b6b1b0a58 appveyor: Add auto deploy to production
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-30 09:08:03 +00:00
fa38c2928b server: Fix accidental crashing bug xD
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-29 10:07:06 +00:00
4560d20b04 server: Log incoming requests on finish
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-29 10:03:35 +00:00
fbf2f5958c server: Don't overwrite host, use service-core defaults
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
package: Increment version
2022-03-12 22:45:05 +00:00
1c85867278 package.json: Increment version
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-12 22:34:34 +00:00
4dab6ea05d server: Read local package.json as opposed to the one in the runner folder
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
2022-03-12 22:33:28 +00:00
3 changed files with 37 additions and 5 deletions

View file

@ -1,12 +1,41 @@
import path from 'path'
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url'
import { Util } from 'service-core'
export function run(http, orgPort, ctx) {
let packagePath = ctx.util.getPathFromRoot('./package.json')
let localUtil = new Util(import.meta.url)
let packagePath = localUtil.getPathFromRoot('../package.json')
let packageInfo = JSON.parse(readFileSync(packagePath))
const server = http.createServer(function (req, res) {
const d1 = new Date().getTime()
let finishedRequest = false
var done = function () {
if (finishedRequest) return
finishedRequest = true
var requestTime = new Date().getTime() - d1
let level = 'info'
if (res.statusCode >= 400) {
level = 'warn'
}
if (res.statusCode >= 500) {
level = 'error'
}
let status = ''
if (res.statusCode >= 400) {
status = res.statusCode + ' '
}
ctx.log[level]({
duration: requestTime,
status: res.statusCode,
}, `<-- ${status}${req.method} ${req.url}`)
}
res.addListener('finish', done);
res.addListener('close', done);
res.writeHead(200);
res.write(JSON.stringify(packageInfo, null, ' '))
res.end()
@ -14,7 +43,7 @@ export function run(http, orgPort, ctx) {
let port = orgPort || 4000
return server.listenAsync(port, '0.0.0.0')
return server.listenAsync(port)
.then(function() {
ctx.log.event.info(`Server is listening on ${port} serving package ${packagePath}`)
ctx.log.info(`Server is listening on ${port} serving package ${packagePath}`)

View file

@ -60,6 +60,9 @@ on_success:
-H "Authorization: token $deploytoken" \
-F "attachment=@${CURR_VER}_build-sc.7z" \
https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases/$RELEASE_ID/assets
echo "Deplying to production"
curl -X POST http://192.168.93.51:8881/update/helloworld
fi
# on build failure

View file

@ -1,6 +1,6 @@
{
"name": "sc-helloworld",
"version": "2.0.0",
"version": "2.0.6",
"description": "Hello World app for service core",
"main": "index.js",
"scripts": {