Skip to content

Commit

Permalink
Add app version to GraphQL URL #10780
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Oct 11, 2024
1 parent d3c669c commit cfecc04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ COMPOSER="$PHP `which composer` --no-interaction --no-plugins"
# Exit script on any error
set -e

echo "Generate version number..."
echo "<?php
declare(strict_types=1);
// Auto-generated by bin/build.sh, do NOT modify
return [
'version' => '`git describe --tags --always`',
];" > config/autoload/version.local.php

echo "Installing git hooks..."
ln -fs ../../bin/pre-commit.sh .git/hooks/pre-commit

Expand Down
1 change: 1 addition & 0 deletions bin/generate-client-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$config = $container->get('config');

$clientKeys = [
'version',
'datatrans',
];

Expand Down
3 changes: 2 additions & 1 deletion client/app/shared/config/apollo-options.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {createHttpLink, NaturalAlertService} from '@ecodev/natural';
import {NetworkActivityService} from '../services/network-activity.service';
import {APOLLO_OPTIONS} from 'apollo-angular';
import {inject, PLATFORM_ID, Provider} from '@angular/core';
import {localConfig} from '../generated-config';

export const apolloDefaultOptions: DefaultOptions = {
query: {
Expand Down Expand Up @@ -62,7 +63,7 @@ function createApolloLink(

return errorLink.concat(
createHttpLink(httpLink, httpBatchLink, {
uri: '/graphql',
uri: '/graphql?v=' + localConfig.version,
}),
);
}
Expand Down

0 comments on commit cfecc04

Please sign in to comment.