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

Feature to allow publishing of an api without having to require any a… #27

Merged
merged 4 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions public/js/apisettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Vue.component('wicked-api', {
<select v-model="value.auth" class="form-control">
<option value="key-auth">Authorize with simple API Keys (key-auth)</option>
<option value="oauth2">Authorize using OAuth 2.0 (oauth2)</option>
<option value="none">Authorization not required</option>
</select>
<wicked-checkbox v-model="value.hide_credentials" label="<b>Hide Credentials</b> from upstream server"/>
</div>
Expand Down Expand Up @@ -150,6 +151,7 @@ Vue.component('wicked-api-kong', {
props: ['value', 'envPrefix'],
template: `
<wicked-panel :open=true title="Kong (Gateway) Configuration" type="primary">
<wicked-input v-model="value.api.host" label="API Host:" hint="API Host, it could be alternate DNS for the service" :env-var="envPrefix + 'HOST'" />
<wicked-input v-model="value.api.upstream_url" label="Upstream (backend) URL:" hint="The URL under which the service can be found, <strong>as seen from the Kong container</strong>" :env-var="envPrefix + 'UPSTREAM_URL'" />
<wicked-string-array v-model="value.api.uris" :allow-empty=false label="Request URIs:" hint="This is the list of prefix you will use for this API on the API Gateway, e.g. <code>/petstore/v1</code>." />
<wicked-checkbox v-model="value.api.strip_uri" label="<b>Strip Uri</b>. Check this box if you don't want to pass the uri to the backend URL as well. Normally you wouldn't want that." />
Expand Down
3 changes: 3 additions & 0 deletions routes/apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ router.get('/:apiId', function (req, res, next) {
const apiId = req.params.apiId;
const safeApiId = utils.makeSafeId(apiId);
const apis = utils.loadApis(req.app);
const glob = utils.loadGlobals(req.app);
const thisApi = apis.apis.find(a => a.id === apiId);
if (!thisApi.hasOwnProperty('requiredGroup'))
thisApi.requiredGroup = '';
Expand Down Expand Up @@ -142,6 +143,8 @@ router.get('/:apiId', function (req, res, next) {
}
debug(thisApi);
const config = utils.loadApiConfig(req.app, apiId);
config.api.host = (config.api.host) ? config.api.host : glob.network.apiHost;

if (!config.plugins)
config.plugins = [];
const plugins = pluginUtils.makeViewModel(config.plugins);
Expand Down