Skip to content

Commit

Permalink
[Code] change back to codeNode (#29073)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedragon authored and zfy0701 committed Jan 22, 2019
1 parent 0a622f2 commit 42e64a1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion x-pack/plugins/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const code = (kibana: any) =>
},
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(false),
enabled: Joi.boolean().default(true),
queueIndex: Joi.string().default('.code-worker-queue'),
// 1 hour by default.
queueTimeout: Joi.number().default(moment.duration(1, 'hour').asMilliseconds()),
Expand All @@ -47,6 +47,7 @@ export const code = (kibana: any) =>
isAdmin: Joi.boolean().default(true), // If we show the admin buttons
disableScheduler: Joi.boolean().default(true), // Temp option to disable all schedulers.
enableGlobalReference: Joi.boolean().default(false), // Global reference as optional feature for now
codeNode: Joi.boolean().default(false),
}).default();
},
init,
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/code/server/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function retryUntilAvailable<T>(
if (value) {
return value;
} else {
return new Promise<T>(resolve => {
const promise = new Promise<T>(resolve => {
const retry = () => {
func().then(v => {
if (v) {
Expand All @@ -57,6 +57,7 @@ async function retryUntilAvailable<T>(
};
setTimeout(retry, intervalMs);
});
return await promise;
}
}

Expand All @@ -77,7 +78,7 @@ export function init(server: Server, options: any) {
enableSecurity(server);
// enable cluster status routes
clusterRoute(server, codeNodeClient, log);
if (serverOptions.enabled) {
if (serverOptions.codeNode) {
let info = await codeNodeClient.getCodeNodeInfo();
if (!info) {
let url: string = server.info.uri;
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/code/server/server_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ export class ServerOptions {

public readonly enabled: boolean = this.options.enabled;

public readonly codeNode: boolean = this.options.codeNode;

constructor(private options: any, private config: any) {}
}
2 changes: 1 addition & 1 deletion x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default async function ({ readConfigFile }) {
'--server.uuid=5b2de169-2785-441b-ae8c-186a1936b17d',
'--xpack.xpack_main.telemetry.enabled=false',
'--xpack.security.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', // server restarts should not invalidate active sessions
'--xpack.code.enabled="true"',
'--xpack.code.codeNode="true"',
],
},
uiSettings: {
Expand Down

0 comments on commit 42e64a1

Please sign in to comment.