Commit 1ed35a18 authored by M. Rehan Abbasi's avatar M. Rehan Abbasi
Browse files

modify meep-vis to be in line with other mec services

parent f8816937
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
    "go.lintFlags": [
        "--fast"
    ],
    "go.useLanguageServer": false,
    // "go.useLanguageServer": false,
    "go.testOnSave": true,
    "[go]": {
        "editor.snippetSuggestions": "none",
+0 −23
Original line number Diff line number Diff line
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
+0 −1
Original line number Diff line number Diff line
3.0.22
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
# Copyright (c) 2020  InterDigital Communications, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:9.6-slim
COPY ./meep-vis /meep-vis
COPY ./api /api
COPY ./user-api /user-api
COPY ./data /

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
+41 −0
Original line number Diff line number Diff line
#!/bin/bash
set -e

echo "MEEP_HOST_URL: ${MEEP_HOST_URL}"
echo "MEEP_SANDBOX_NAME: ${MEEP_SANDBOX_NAME}"
echo "MEEP_MEP_NAME: ${MEEP_MEP_NAME}"

if [[ ! -z "${MEEP_MEP_NAME}" ]]; then
    svcPath="${MEEP_SANDBOX_NAME}/${MEEP_MEP_NAME}"
else
    svcPath="${MEEP_SANDBOX_NAME}"
fi

# Update API yaml basepaths to enable "Try-it-out" feature
# OAS2: Set relative path to sandbox name + endpoint path (origin will be derived from browser URL)
# OAS3: Set full path to provided Host URL + sandbox name + endpoint path
setBasepath() {
    # OAS3
    hostName=$(echo "${MEEP_HOST_URL}" | sed -E 's/^\s*.*:\/\///g')
    echo "Replacing [localhost] with ${hostName} to url in: '$1'"
    sed -i "s,localhost,${hostName},g" "$1";

    # OAS2 and OAS3
    echo "Replacing [sandboxname] with ${svcPath} to basepath or url in: '$1'"
    sed -i "s,sandboxname,${svcPath},g" "$1";
}

# Set basepath for API files
for file in /api/*; do
    if [[ ! -e "$file" ]]; then continue; fi
    setBasepath "$file"
done

# Set basepath for user-supplied API files
for file in /user-api/*; do
    if [[ ! -e "$file" ]]; then continue; fi
    setBasepath "$file"
done

# Start service
exec /meep-vis
Loading