mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-19 00:10:39 +08:00
chore(server): disable indexer by default (#12710)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated the default setting for the indexer feature to be disabled by default. - Added a sample environment variable for enabling the indexer in the example configuration file. - Introduced a new environment variable for the indexer in the CI workflow configuration. - **Tests** - Adjusted test configurations to explicitly enable the indexer feature during test execution. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -886,8 +886,8 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"enabled": {
|
"enabled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Enable indexer plugin\n@default true\n@environment `AFFINE_INDEXER_ENABLED`",
|
"description": "Enable indexer plugin\n@default false\n@environment `AFFINE_INDEXER_ENABLED`",
|
||||||
"default": true
|
"default": false
|
||||||
},
|
},
|
||||||
"provider.type": {
|
"provider.type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ env:
|
|||||||
COVERAGE: true
|
COVERAGE: true
|
||||||
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||||||
DEPLOYMENT_TYPE: affine
|
DEPLOYMENT_TYPE: affine
|
||||||
|
AFFINE_INDEXER_ENABLED: true
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|||||||
@@ -9,4 +9,6 @@
|
|||||||
# MAILER_SENDER="noreply@toeverything.info"
|
# MAILER_SENDER="noreply@toeverything.info"
|
||||||
# MAILER_USER="noreply@toeverything.info"
|
# MAILER_USER="noreply@toeverything.info"
|
||||||
# MAILER_PASSWORD="affine"
|
# MAILER_PASSWORD="affine"
|
||||||
# MAILER_SECURE=false
|
# MAILER_SECURE=false
|
||||||
|
|
||||||
|
# AFFINE_INDEXER_ENABLED=true
|
||||||
|
|||||||
@@ -3,11 +3,19 @@ import Sinon from 'sinon';
|
|||||||
|
|
||||||
import { createModule } from '../../../__tests__/create-module';
|
import { createModule } from '../../../__tests__/create-module';
|
||||||
import { Config } from '../../../base';
|
import { Config } from '../../../base';
|
||||||
|
import { ConfigModule } from '../../../base/config';
|
||||||
import { IndexerModule } from '..';
|
import { IndexerModule } from '..';
|
||||||
import { IndexerEvent } from '../event';
|
import { IndexerEvent } from '../event';
|
||||||
|
|
||||||
const module = await createModule({
|
const module = await createModule({
|
||||||
imports: [IndexerModule],
|
imports: [
|
||||||
|
IndexerModule,
|
||||||
|
ConfigModule.override({
|
||||||
|
indexer: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const indexerEvent = module.get(IndexerEvent);
|
const indexerEvent = module.get(IndexerEvent);
|
||||||
const config = module.get(Config);
|
const config = module.get(Config);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Sinon from 'sinon';
|
|||||||
import { createModule } from '../../../__tests__/create-module';
|
import { createModule } from '../../../__tests__/create-module';
|
||||||
import { Mockers } from '../../../__tests__/mocks';
|
import { Mockers } from '../../../__tests__/mocks';
|
||||||
import { JOB_SIGNAL } from '../../../base';
|
import { JOB_SIGNAL } from '../../../base';
|
||||||
|
import { ConfigModule } from '../../../base/config';
|
||||||
import { ServerConfigModule } from '../../../core/config';
|
import { ServerConfigModule } from '../../../core/config';
|
||||||
import { Models } from '../../../models';
|
import { Models } from '../../../models';
|
||||||
import { IndexerModule, IndexerService } from '..';
|
import { IndexerModule, IndexerService } from '..';
|
||||||
@@ -15,7 +16,15 @@ import { IndexerJob } from '../job';
|
|||||||
import { ManticoresearchProvider } from '../providers';
|
import { ManticoresearchProvider } from '../providers';
|
||||||
|
|
||||||
const module = await createModule({
|
const module = await createModule({
|
||||||
imports: [IndexerModule, ServerConfigModule],
|
imports: [
|
||||||
|
IndexerModule,
|
||||||
|
ServerConfigModule,
|
||||||
|
ConfigModule.override({
|
||||||
|
indexer: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
providers: [IndexerService],
|
providers: [IndexerService],
|
||||||
});
|
});
|
||||||
const indexerService = module.get(IndexerService);
|
const indexerService = module.get(IndexerService);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ _test.before(async () => {
|
|||||||
IndexerModule,
|
IndexerModule,
|
||||||
ConfigModule.override({
|
ConfigModule.override({
|
||||||
indexer: {
|
indexer: {
|
||||||
|
enabled: true,
|
||||||
provider: {
|
provider: {
|
||||||
type: SearchProviderType.Elasticsearch,
|
type: SearchProviderType.Elasticsearch,
|
||||||
endpoint: 'http://localhost:9200',
|
endpoint: 'http://localhost:9200',
|
||||||
|
|||||||
+1
@@ -18,6 +18,7 @@ const module = await createModule({
|
|||||||
IndexerModule,
|
IndexerModule,
|
||||||
ConfigModule.override({
|
ConfigModule.override({
|
||||||
indexer: {
|
indexer: {
|
||||||
|
enabled: true,
|
||||||
provider: {
|
provider: {
|
||||||
type: SearchProviderType.Manticoresearch,
|
type: SearchProviderType.Manticoresearch,
|
||||||
endpoint: 'http://localhost:9308',
|
endpoint: 'http://localhost:9308',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { omit, pick } from 'lodash-es';
|
|||||||
|
|
||||||
import { createModule } from '../../../__tests__/create-module';
|
import { createModule } from '../../../__tests__/create-module';
|
||||||
import { Mockers } from '../../../__tests__/mocks';
|
import { Mockers } from '../../../__tests__/mocks';
|
||||||
|
import { ConfigModule } from '../../../base/config';
|
||||||
import { ServerConfigModule } from '../../../core/config';
|
import { ServerConfigModule } from '../../../core/config';
|
||||||
import { IndexerModule, IndexerService } from '..';
|
import { IndexerModule, IndexerService } from '..';
|
||||||
import { SearchProviderFactory } from '../factory';
|
import { SearchProviderFactory } from '../factory';
|
||||||
@@ -20,7 +21,15 @@ import {
|
|||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
const module = await createModule({
|
const module = await createModule({
|
||||||
imports: [IndexerModule, ServerConfigModule],
|
imports: [
|
||||||
|
IndexerModule,
|
||||||
|
ServerConfigModule,
|
||||||
|
ConfigModule.override({
|
||||||
|
indexer: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
providers: [IndexerService],
|
providers: [IndexerService],
|
||||||
});
|
});
|
||||||
const indexerService = module.get(IndexerService);
|
const indexerService = module.get(IndexerService);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ declare global {
|
|||||||
defineModuleConfig('indexer', {
|
defineModuleConfig('indexer', {
|
||||||
enabled: {
|
enabled: {
|
||||||
desc: 'Enable indexer plugin',
|
desc: 'Enable indexer plugin',
|
||||||
default: true,
|
default: false,
|
||||||
env: ['AFFINE_INDEXER_ENABLED', 'boolean'],
|
env: ['AFFINE_INDEXER_ENABLED', 'boolean'],
|
||||||
},
|
},
|
||||||
'provider.type': {
|
'provider.type': {
|
||||||
|
|||||||
Reference in New Issue
Block a user