fix installation registration
This commit is contained in:
parent
55ab5062de
commit
a4ab61dcec
14
doc/cli.md
Normal file
14
doc/cli.md
Normal file
@ -0,0 +1,14 @@
|
||||
# CLI
|
||||
|
||||
Run `yarn cli` to get basic information of available commands
|
||||
|
||||
## user commands
|
||||
|
||||
### `yarn cli user create`
|
||||
|
||||
create a new user
|
||||
|
||||
### `yarn cli user activate <username>`
|
||||
|
||||
activate the given user
|
||||
|
||||
12
doc/environment.md
Normal file
12
doc/environment.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Environment Variables
|
||||
|
||||
| Name | Default Value | Description |
|
||||
| ---- | ------------- | ----------- |
|
||||
| DISABLE_INSTALLATION_METRICS | *not set* | Per default installations are [publishing](./installation.metrics.md) their existence |
|
||||
| SECRET_KEY | `changeMe` | JWT Secret for authentication |
|
||||
| MONGODB_URI | `mongodb://localhost/ohmyform` | MongoDB Connection |
|
||||
| MAILER_URI | `smtp://localhost:1025` | [Mail Connection](https://nodemailer.com/smtp/) |
|
||||
| MAILER_FROM | `OhMyForm <no-reply@localhost>` | Default From path, make sure that your mail server supports the given from addres |
|
||||
| CLI | *automatically* | activates pretty print for log output |
|
||||
| NODE_ENV | `production` | |
|
||||
|
||||
11
doc/installation.metrics.md
Normal file
11
doc/installation.metrics.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Installation Metrics
|
||||
|
||||
OhMyForm sends a PING during startup as well as once
|
||||
every hour to get instights on where OhMyForm is used.
|
||||
|
||||
If you feed that this should not happen you can disable
|
||||
this behavior by setting the environment variable
|
||||
`DISABLE_INSTALLATION_METRICS=1`
|
||||
|
||||
You can take a look [here](../src/service/installation.metrics.service.ts) to see how we trigger the metric
|
||||
collection
|
||||
@ -1,4 +1,5 @@
|
||||
import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import MatomoTracker from 'matomo-tracker';
|
||||
import { PinoLogger } from 'nestjs-pino/dist';
|
||||
|
||||
@ -8,24 +9,39 @@ export class InstallationMetricsService implements OnApplicationBootstrap {
|
||||
|
||||
constructor(
|
||||
private readonly logger: PinoLogger,
|
||||
private readonly configService: ConfigService,
|
||||
) {
|
||||
}
|
||||
|
||||
async onApplicationBootstrap(): Promise<void> {
|
||||
if (this.configService.get<boolean>('DISABLE_INSTALLATION_METRICS')) {
|
||||
this.logger.info('installation metrics are disabled')
|
||||
return
|
||||
}
|
||||
|
||||
const tracker = new MatomoTracker(2, this.host)
|
||||
|
||||
tracker.on('error', () => {
|
||||
this.logger.error('failed to add installation metrics')
|
||||
})
|
||||
|
||||
this.logger.info('try to add installation metrics')
|
||||
|
||||
this.logger.info('try to add startup metric')
|
||||
tracker.track({
|
||||
url: `http://localhost/version/${process.env.npm_package_version}`,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
action_name: 'startup',
|
||||
ua: process.arch
|
||||
})
|
||||
|
||||
setInterval(() => {
|
||||
this.logger.info('try to add running metric')
|
||||
tracker.track({
|
||||
url: `http://localhost/version/${process.env.npm_package_version}`,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
action_name: 'running',
|
||||
ua: process.arch
|
||||
})
|
||||
}, 3600000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user