Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added host and protocol config fields for frontend and server packages #78

Merged
merged 20 commits into from
Sep 12, 2018
Merged

Added host and protocol config fields for frontend and server packages #78

merged 20 commits into from
Sep 12, 2018

Conversation

PatrickShaw
Copy link
Collaborator

@PatrickShaw PatrickShaw commented Sep 9, 2018

Added some more configuration options to the mix. Not all of them are used properly just yet (E.g. https for the protocol field).

@@ -1,19 +1,21 @@
import webpack from 'webpack';

import { readConfig } from '@openapi-platform/config';
import { uiUrl } from '@openapi-platform/config';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused (are you running tsc to check?).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to pick up on it. We're using gulp-typescript but running tsc directly doesn't seem to pick up on it either. I'll look into it before the PR gets accepted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured it out. Seems we're going to have to deal with no-unused-variable deprecation warnings for a while: palantir/tslint#4100

return urlFromConfig(config, 'server');
}

export function uiUrl(config): string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also unused.

@@ -32,7 +32,7 @@ async function insertSampleData(client) {
async function run() {
const config = readConfig();
const { client, socket } = createServerClient(
`http://localhost:${config.get('server.port')}`,
serverUrl(config),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work, what if my server address is 0.0.0.0? I'd probably add something like apiBaseUrl for the scripts.

Copy link
Collaborator Author

@PatrickShaw PatrickShaw Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good pick up. It can just use ui.apiBaseUrl. I'm not adding extra config just for some dev scripts.

Gulpfile.js Outdated
const openapiPlatformConfig = readConfig();
const createWebpackConfig = require(join(packageDir, 'webpack.config'));
const webpackConfig = createWebpackConfig({
NODE_ENV: process.env.NODE_ENV,
API_PORT: openapiPlatformConfig.get('server.port'),
env: process.env.NODE_ENV,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why this is needed when convict will automatically populate the env configuration option from NODE_ENV for us? Can't we just pass in config.env?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're so right, that didn't even occur to me. Good pick up :)

)}`;
}

export function uiUrl(config): string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of uiUrl or serverUrl are used anywhere. Can we remove these functions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serverUrl is the default to apiBaseUrl.
With regard to uiUrl I want to be consistent - If I provide url helpers for server and api urls, i want to do the same thing for the UI URL even if it's not used by anything at the moment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point with uiUrl, but apiBaseUrl doesn't use serverUrl at all here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is now :P

@PatrickShaw PatrickShaw merged commit a6f7a20 into telstra:development Sep 12, 2018
@PatrickShaw PatrickShaw deleted the more-configuration branch October 23, 2018 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants