Skip to content
Snippets Groups Projects
Commit 61c51d08 authored by Steve Reis's avatar Steve Reis
Browse files

Merge branch 'feat/matomo' into 'develop'

Matomo integration

See merge request sibmip/gateway!53
parents 93aa5bad 574e666d
No related branches found
No related tags found
No related merge requests found
import { registerAs } from '@nestjs/config';
export default registerAs('matomo', () => {
return {
enabled: process.env.MATOMO_ENABLED || false,
urlBase: process.env.MAMOTO_URL || undefined,
siteId: process.env.MATOMO_SITEID || undefined,
};
});
......@@ -41,18 +41,20 @@ export class EngineResolver {
@Public()
configuration(): Configuration {
const config = this.engineService.getConfiguration?.();
const matomo = this.configSerivce.get('matomo');
const data = {
...(config ?? {}),
skipAuth: parseToBoolean(
this.configSerivce.get(authConstants.skipAuth),
true,
),
connectorId: this.engineOptions.type,
skipTos: parseToBoolean(this.configSerivce.get(ENGINE_SKIP_TOS)),
enableSSO: parseToBoolean(
this.configSerivce.get(authConstants.enableSSO),
),
connectorId: this.engineOptions.type,
skipAuth: parseToBoolean(
this.configSerivce.get(authConstants.skipAuth),
true,
),
matomo,
};
const version = Md5.hashStr(JSON.stringify(data));
......
import { Field, ObjectType } from '@nestjs/graphql';
import { Matomo } from './configuration/matomo.model';
@ObjectType()
export class Configuration {
@Field()
......@@ -21,4 +22,7 @@ export class Configuration {
@Field({ nullable: true, defaultValue: true })
enableSSO?: boolean;
@Field(() => Matomo, { nullable: true })
matomo?: Matomo;
}
import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class Matomo {
@Field({ nullable: true, defaultValue: false })
enabled?: boolean;
@Field({ nullable: true })
siteId?: string;
@Field({ nullable: true })
urlBase?: string;
}
......@@ -7,6 +7,7 @@ import { GraphQLError } from 'graphql';
import { join } from 'path';
import { AuthModule } from 'src/auth/auth.module';
import dbConfig from 'src/config/db.config';
import matomoConfig from 'src/config/matomo.config';
import { EngineModule } from 'src/engine/engine.module';
import { FilesModule } from 'src/files/files.module';
import { UsersModule } from 'src/users/users.module';
......@@ -18,7 +19,7 @@ import { AppService } from './app.service';
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ['.env', '.env.defaults'],
load: [dbConfig],
load: [dbConfig, matomoConfig],
}),
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver,
......
......@@ -14,6 +14,12 @@ type AuthenticationOutput {
accessToken: String!
}
type Matomo {
enabled: Boolean
siteId: String
urlBase: String
}
type Configuration {
connectorId: String!
hasGalaxy: Boolean
......@@ -22,6 +28,7 @@ type Configuration {
skipAuth: Boolean
skipTos: Boolean
enableSSO: Boolean
matomo: Matomo
}
type Dataset {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment