-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e35684
commit 7410c1d
Showing
10 changed files
with
111 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { build_info } = require( "inaturalistjs" ); | ||
const process = require( "process" ); | ||
const fetch = require( "node-fetch" ); | ||
const InaturalistAPI = require( "../../inaturalist_api" ); | ||
const util = require( "../../util" ); | ||
const config = require( "../../../config" ); | ||
|
||
const index = async req => { | ||
if ( !req.userSession || ( req.userSession && !req.userSession.isAdmin ) ) { | ||
throw util.httpError( 401, "Unauthorized" ); | ||
} | ||
// Get Rails Build Info | ||
const railsBuildInfoJSON = await InaturalistAPI.iNatJSWrap( build_info.get, req ); | ||
// Get API Build Info | ||
const apiBuildInfoJSON = { | ||
git_branch: process.env.GIT_BRANCH, | ||
git_commit: process.env.GIT_COMMIT, | ||
image_tag: process.env.IMAGE_TAG, | ||
build_date: process.env.BUILD_DATE | ||
}; | ||
// Get Vision Build Info | ||
let visionBuildInfoJSON = {}; | ||
try { | ||
const response = await fetch( `${config.imageProcesing.tensorappURL}/build_info` ); | ||
if ( !response.ok ) { | ||
throw util.httpError( 500, "Error" ); | ||
} | ||
visionBuildInfoJSON = await response.json( ); | ||
} catch ( error ) { | ||
throw util.httpError( 500, "Error" ); | ||
} | ||
// Application Build Info | ||
const appBuildInfoJSON = { | ||
rails: railsBuildInfoJSON, | ||
api: apiBuildInfoJSON, | ||
vision: visionBuildInfoJSON | ||
}; | ||
return appBuildInfoJSON; | ||
}; | ||
|
||
module.exports = { | ||
index | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const AppBuildInfoController = require( "../../../lib/controllers/v2/app_build_info_controller" ); | ||
|
||
module.exports = sendWrapper => { | ||
async function GET( req, res ) { | ||
const results = await AppBuildInfoController.index( req ); | ||
sendWrapper( req, res, null, results ); | ||
} | ||
|
||
GET.apiDoc = { | ||
tags: ["AppBuildInfo"], | ||
summary: "Display application build information", | ||
security: [{ | ||
userJwtRequired: [] | ||
}], | ||
responses: { | ||
200: { | ||
description: "Application build information", | ||
content: { | ||
"application/json": { | ||
schema: { | ||
$ref: "#/components/schemas/AppBuildInfo" | ||
} | ||
} | ||
} | ||
}, | ||
default: { | ||
$ref: "#/components/responses/Error" | ||
} | ||
}, | ||
"x-unpublished": true | ||
}; | ||
|
||
return { | ||
GET | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const Joi = require( "joi" ); | ||
|
||
module.exports = Joi.object( ).keys( {} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const Joi = require( "joi" ); | ||
|
||
module.exports = Joi.object( ).keys( { | ||
rails: Joi.object( ).keys( { | ||
git_branch: Joi.string( ), | ||
git_commit: Joi.string( ), | ||
image_tag: Joi.string( ), | ||
build_date: Joi.string( ) | ||
} ), | ||
api: Joi.object( ).keys( { | ||
git_branch: Joi.string( ), | ||
git_commit: Joi.string( ), | ||
image_tag: Joi.string( ), | ||
build_date: Joi.string( ) | ||
} ), | ||
vision: Joi.object( ).keys( { | ||
git_branch: Joi.string( ), | ||
git_commit: Joi.string( ), | ||
image_tag: Joi.string( ), | ||
build_date: Joi.string( ) | ||
} ) | ||
} ).unknown( false ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters