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 { ...@@ -41,18 +41,20 @@ export class EngineResolver {
@Public() @Public()
configuration(): Configuration { configuration(): Configuration {
const config = this.engineService.getConfiguration?.(); const config = this.engineService.getConfiguration?.();
const matomo = this.configSerivce.get('matomo');
const data = { const data = {
...(config ?? {}), ...(config ?? {}),
skipAuth: parseToBoolean( connectorId: this.engineOptions.type,
this.configSerivce.get(authConstants.skipAuth),
true,
),
skipTos: parseToBoolean(this.configSerivce.get(ENGINE_SKIP_TOS)), skipTos: parseToBoolean(this.configSerivce.get(ENGINE_SKIP_TOS)),
enableSSO: parseToBoolean( enableSSO: parseToBoolean(
this.configSerivce.get(authConstants.enableSSO), 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)); const version = Md5.hashStr(JSON.stringify(data));
......
import { Field, ObjectType } from '@nestjs/graphql'; import { Field, ObjectType } from '@nestjs/graphql';
import { Matomo } from './configuration/matomo.model';
@ObjectType() @ObjectType()
export class Configuration { export class Configuration {
@Field() @Field()
...@@ -21,4 +22,7 @@ export class Configuration { ...@@ -21,4 +22,7 @@ export class Configuration {
@Field({ nullable: true, defaultValue: true }) @Field({ nullable: true, defaultValue: true })
enableSSO?: boolean; 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'; ...@@ -7,6 +7,7 @@ import { GraphQLError } from 'graphql';
import { join } from 'path'; import { join } from 'path';
import { AuthModule } from 'src/auth/auth.module'; import { AuthModule } from 'src/auth/auth.module';
import dbConfig from 'src/config/db.config'; import dbConfig from 'src/config/db.config';
import matomoConfig from 'src/config/matomo.config';
import { EngineModule } from 'src/engine/engine.module'; import { EngineModule } from 'src/engine/engine.module';
import { FilesModule } from 'src/files/files.module'; import { FilesModule } from 'src/files/files.module';
import { UsersModule } from 'src/users/users.module'; import { UsersModule } from 'src/users/users.module';
...@@ -18,7 +19,7 @@ import { AppService } from './app.service'; ...@@ -18,7 +19,7 @@ import { AppService } from './app.service';
ConfigModule.forRoot({ ConfigModule.forRoot({
isGlobal: true, isGlobal: true,
envFilePath: ['.env', '.env.defaults'], envFilePath: ['.env', '.env.defaults'],
load: [dbConfig], load: [dbConfig, matomoConfig],
}), }),
GraphQLModule.forRoot<ApolloDriverConfig>({ GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver, driver: ApolloDriver,
......
...@@ -14,6 +14,12 @@ type AuthenticationOutput { ...@@ -14,6 +14,12 @@ type AuthenticationOutput {
accessToken: String! accessToken: String!
} }
type Matomo {
enabled: Boolean
siteId: String
urlBase: String
}
type Configuration { type Configuration {
connectorId: String! connectorId: String!
hasGalaxy: Boolean hasGalaxy: Boolean
...@@ -22,6 +28,7 @@ type Configuration { ...@@ -22,6 +28,7 @@ type Configuration {
skipAuth: Boolean skipAuth: Boolean
skipTos: Boolean skipTos: Boolean
enableSSO: Boolean enableSSO: Boolean
matomo: Matomo
} }
type Dataset { 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