forked from niki-timofe/verdaccio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fastify] Add ping endpoint (verdaccio#2246)
* chore: add ping endpoint * Update package.json * rebase from master * add debug code and logger * Update index.ts * Create heavy-ravens-lay.md * endpoint as plugin * chore: format * Update packages/core/server/debug/index.ts Co-authored-by: Manuel Spigolon <[email protected]> * add logger instance to fastify * 4873 port * format file * add logger Co-authored-by: Manuel Spigolon <[email protected]>
- Loading branch information
1 parent
4ebf188
commit 55ee3fd
Showing
9 changed files
with
159 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@verdaccio/cli': minor | ||
'@verdaccio/fastify-migration': minor | ||
--- | ||
|
||
[Fastify] Add ping endpoint |
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,39 @@ | ||
storage: ./storage | ||
plugins: ./plugins | ||
web: | ||
title: Verdaccio | ||
|
||
auth: | ||
htpasswd: | ||
file: ./htpasswd | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
|
||
packages: | ||
'@*/*': | ||
access: $all | ||
publish: $authenticated | ||
unpublish: $authenticated | ||
proxy: npmjs | ||
|
||
'**': | ||
access: $all | ||
publish: $authenticated | ||
unpublish: $authenticated | ||
proxy: npmjs | ||
|
||
server: | ||
keepAliveTimeout: 60 | ||
|
||
middlewares: | ||
audit: | ||
enabled: true | ||
|
||
log: { type: stdout, format: pretty, level: http } | ||
flags: | ||
token: false | ||
search: false | ||
|
||
i18n: | ||
web: en-US |
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,30 @@ | ||
import path from 'path'; | ||
import buildDebug from 'debug'; | ||
import { parseConfigFile } from '@verdaccio/config'; | ||
import { setup, logger } from '@verdaccio/logger'; | ||
import server from '../src/index'; | ||
|
||
const debug = buildDebug('verdaccio:fastify:debug'); | ||
|
||
/** | ||
* This file is intended for fast development and debug, it should | ||
* be removed eventually and the app start from @verdaccio/cli package. | ||
*/ | ||
(async () => { | ||
try { | ||
const configFile = path.join(__dirname, './fastify-conf.yaml'); | ||
debug('configFile %s', configFile); | ||
const configParsed = parseConfigFile(configFile); | ||
setup(configParsed.log); | ||
logger.info(`config location ${configFile}`); | ||
debug('configParsed %s', configParsed); | ||
process.title = 'fastify-verdaccio'; | ||
const ser = await server({ logger }); | ||
await ser.listen(4873); | ||
logger.info('fastify running on port 4873'); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
})(); |
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,10 @@ | ||
import { logger } from '@verdaccio/logger'; | ||
|
||
async function pingRoute(fastify) { | ||
fastify.get('/-/ping', async () => { | ||
logger.http('ping endpoint'); | ||
return {}; | ||
}); | ||
} | ||
|
||
export default pingRoute; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.