Skip to content

Commit

Permalink
remove env.staticFilesDir (unused)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Dec 19, 2019
1 parent 3f78c81 commit 431e3f0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 31 deletions.
6 changes: 0 additions & 6 deletions src/core/server/config/__snapshots__/env.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/core/server/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ export class Env {
/** @internal */
public readonly logDir: string;
/** @internal */
public readonly staticFilesDir: string;
/** @internal */
public readonly pluginSearchPaths: readonly string[];

/**
Expand Down Expand Up @@ -101,7 +99,6 @@ export class Env {
this.configDir = resolve(this.homeDir, 'config');
this.binDir = resolve(this.homeDir, 'bin');
this.logDir = resolve(this.homeDir, 'log');
this.staticFilesDir = resolve(this.homeDir, 'ui');

this.pluginSearchPaths = [
resolve(this.homeDir, 'src', 'plugins'),
Expand Down
11 changes: 3 additions & 8 deletions src/core/server/http/http_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import uuid from 'uuid';
import { config, HttpConfig } from '.';
import { Env } from '../config';
import { getEnvOptions } from '../config/__mocks__/env';

const validHostnames = ['www.example.com', '8.8.8.8', '::1', 'localhost'];
const invalidHostname = 'asdf$%^';
Expand Down Expand Up @@ -265,8 +263,7 @@ describe('with TLS', () => {
clientAuthentication: 'none',
},
}),
{} as any,
Env.createDefault(getEnvOptions())
{} as any
);

expect(httpConfig.ssl.requestCert).toBe(false);
Expand All @@ -283,8 +280,7 @@ describe('with TLS', () => {
clientAuthentication: 'optional',
},
}),
{} as any,
Env.createDefault(getEnvOptions())
{} as any
);

expect(httpConfig.ssl.requestCert).toBe(true);
Expand All @@ -301,8 +297,7 @@ describe('with TLS', () => {
clientAuthentication: 'required',
},
}),
{} as any,
Env.createDefault(getEnvOptions())
{} as any
);

expect(httpConfig.ssl.requestCert).toBe(true);
Expand Down
5 changes: 1 addition & 4 deletions src/core/server/http/http_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import { ByteSizeValue, schema, TypeOf } from '@kbn/config-schema';
import { Env } from '../config';
import { CspConfigType, CspConfig, ICspConfig } from '../csp';
import { SslConfig, sslSchema } from './ssl_config';

Expand Down Expand Up @@ -135,7 +134,6 @@ export class HttpConfig {
public maxPayload: ByteSizeValue;
public basePath?: string;
public rewriteBasePath: boolean;
public publicDir: string;
public defaultRoute?: string;
public ssl: SslConfig;
public compression: { enabled: boolean; referrerWhitelist?: string[] };
Expand All @@ -144,7 +142,7 @@ export class HttpConfig {
/**
* @internal
*/
constructor(rawHttpConfig: HttpConfigType, rawCspConfig: CspConfigType, env: Env) {
constructor(rawHttpConfig: HttpConfigType, rawCspConfig: CspConfigType) {
this.autoListen = rawHttpConfig.autoListen;
this.host = rawHttpConfig.host;
this.port = rawHttpConfig.port;
Expand All @@ -154,7 +152,6 @@ export class HttpConfig {
this.keepaliveTimeout = rawHttpConfig.keepaliveTimeout;
this.socketTimeout = rawHttpConfig.socketTimeout;
this.rewriteBasePath = rawHttpConfig.rewriteBasePath;
this.publicDir = env.staticFilesDir;
this.ssl = new SslConfig(rawHttpConfig.ssl || {});
this.defaultRoute = rawHttpConfig.defaultRoute;
this.compression = rawHttpConfig.compression;
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export class HttpService implements CoreService<InternalHttpServiceSetup, HttpSe
private requestHandlerContext?: RequestHandlerContextContainer;

constructor(private readonly coreContext: CoreContext) {
const { logger, configService, env } = coreContext;
const { logger, configService } = coreContext;

this.logger = logger;
this.log = logger.get('http');
this.config$ = combineLatest(
configService.atPath<HttpConfigType>(httpConfig.path),
configService.atPath<CspConfigType>(cspConfig.path)
).pipe(map(([http, csp]) => new HttpConfig(http, csp, env)));
).pipe(map(([http, csp]) => new HttpConfig(http, csp)));
this.httpServer = new HttpServer(logger, 'Kibana');
this.httpsRedirectServer = new HttpsRedirectServer(logger.get('http', 'redirect', 'server'));
}
Expand Down
8 changes: 2 additions & 6 deletions src/core/server/http/http_tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import { HttpConfig, config } from './http_config';
import { Router } from './router';
import { loggingServiceMock } from '../logging/logging_service.mock';
import { ByteSizeValue } from '@kbn/config-schema';
import { Env } from '../config';
import { getEnvOptions } from '../config/__mocks__/env';

const emptyOutput = {
statusCode: 400,
Expand Down Expand Up @@ -122,8 +120,7 @@ describe('getServerOptions', () => {
certificate: 'some-certificate-path',
},
}),
{} as any,
Env.createDefault(getEnvOptions())
{} as any
);

expect(getServerOptions(httpConfig).tls).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -152,8 +149,7 @@ describe('getServerOptions', () => {
clientAuthentication: 'required',
},
}),
{} as any,
Env.createDefault(getEnvOptions())
{} as any
);

expect(getServerOptions(httpConfig).tls).toMatchInlineSnapshot(`
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class LegacyService implements CoreService {
private settings: Record<string, any> | undefined;

constructor(private readonly coreContext: CoreContext) {
const { logger, configService, env } = coreContext;
const { logger, configService } = coreContext;

this.log = logger.get('legacy-service');
this.devConfig$ = configService
Expand All @@ -122,7 +122,7 @@ export class LegacyService implements CoreService {
this.httpConfig$ = combineLatest(
configService.atPath<HttpConfigType>(httpConfig.path),
configService.atPath<CspConfigType>(cspConfig.path)
).pipe(map(([http, csp]) => new HttpConfig(http, csp, env)));
).pipe(map(([http, csp]) => new HttpConfig(http, csp)));
}

public async discoverPlugins(): Promise<LegacyServiceDiscoverPlugins> {
Expand Down

0 comments on commit 431e3f0

Please sign in to comment.