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

Base URL placeholder added #69

Merged
merged 7 commits into from
Dec 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void run( String languageName, String baseName, String extension,
CliProjectsCreatorMain.main(args);

// Add activity files
final String basePackage = baseName.substring(0, baseName.lastIndexOf(".")); // Everything but last segment which is the language java class
final String basePackage = languageName.substring(0, languageName.lastIndexOf(".")); // Everything but last segment which is the language java class
final String shortName = languageName.substring(languageName.lastIndexOf(".") + 1); // The last segment
final String languagePath = PROJECT_PATH + baseName + "/src/" + basePackage.replace('.', '/');

Expand Down
2 changes: 1 addition & 1 deletion static.conversion/public/conversion_tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

"returnType": "xmi",

"path": "http://127.0.0.1:8069/services/FlexmiToXmi"
"path": "{{BASE-URL}}:8069/services/FlexmiToXmi"
aryaei2000 marked this conversation as resolved.
Show resolved Hide resolved

}

Expand Down
2 changes: 1 addition & 1 deletion static.emf/public/emf_tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

"returnType": "diagram",

"path": "http://127.0.0.1:8070/emfatic2plantuml"
"path": "{{BASE-URL}}:8070/emfatic2plantuml"

},

Expand Down
4 changes: 2 additions & 2 deletions static.emfatic/public/emfatic_tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

"returnType": "emfatic",

"path": "http://127.0.0.1:8071/services/EcoreToEmfatic"
"path": "{{BASE-URL}}:8071/services/EcoreToEmfatic"

},

Expand All @@ -37,7 +37,7 @@

"returnType": "ecore",

"path": "http://127.0.0.1:8071/services/EmfaticToEcore"
"path": "{{BASE-URL}}:8071/services/EmfaticToEcore"

}

Expand Down
2 changes: 1 addition & 1 deletion static.ocl/public/ocl_tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

"returnType": "text",

"path": "http://127.0.0.1:8072/services/RunOclFunction"
"path": "{{BASE-URL}}:8072/services/RunOclFunction"

}

Expand Down
2 changes: 1 addition & 1 deletion static.ocl/public/ocl_tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tool:
type: xmi
- name: language
type: text
path: http://127.0.0.1:8072/services/RunOclFunction
path: {{BASE-URL}}:8072/services/RunOclFunction
returnType: text
panelDefs:
- buttons:
Expand Down
9 changes: 8 additions & 1 deletion xtext/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

FROM node:19-bullseye AS toolstaticbuild

# comma delimited whitelist of base URLs (with no trailing slash) for CORS aware endpoints
ARG TRUSTED_ORIGINS
aryaei2000 marked this conversation as resolved.
Show resolved Hide resolved

RUN apt-get update && apt-get install -y --no-install-recommends zip

WORKDIR /usr/src/mdenet-tool
Expand All @@ -19,6 +22,8 @@ RUN npm install; npm run build; chmod -R 755 dist/
# CORS configuration for webapp
COPY xtext/acemodebundler/web.xml /usr/src/mdenet-tool/dist/WEB-INF/web.xml

RUN sed -i "s|http://127.0.0.1:8080|$TRUSTED_ORIGINS|g" /usr/src/mdenet-tool/dist/WEB-INF/web.xml

RUN cd dist && zip -r ROOT.war .


Expand All @@ -43,6 +48,8 @@ RUN mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.0:get -Dartifact=co

FROM tomcat:9.0.76-jdk17-temurin

# See https://github.com/mdenet/educationplatform-docker/blob/development_server/README.md#environment-variables
ARG ES_ADDRESS
aryaei2000 marked this conversation as resolved.
Show resolved Hide resolved

# toolserice main endpoint port
ENV TS_PORT=9000
Expand Down Expand Up @@ -109,4 +116,4 @@ ENV XTEXT_ES_STOP_CRON_TIME="* 4 * * *"
# setup cron job to periodically stop the server
RUN ./cron-setup.sh

ENTRYPOINT [ "/bin/bash", "start.sh" ]
ENTRYPOINT [ "/bin/bash", "start.sh" ]
4 changes: 2 additions & 2 deletions xtext/editorserver/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const config = {

endpointsPrefix: process.env.ES_ENDPOINT_PREFIX || "",

trustedWebOrigins: ['http://127.0.0.1:8080'],
trustedWebOrigins: [process.env.TRUSTED_ORIGIN || "http://127.0.0.1:8080"],


}
}
7 changes: 6 additions & 1 deletion xtext/start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! /bin/bash

if [ -n "${TRUSTED_ORIGINS}" ]; then
sed -i "s|http://127.0.0.1:8080|${TRUSTED_ORIGINS}|g" ${ES_DEPLOY_FILE_LOCATION}/ROOT/WEB-INF/web.xml
sed -i "s|http://127.0.0.1:8080|${TRUSTED_ORIGINS}|g" ../acemodebundler/web.xml
fi

# clean any previous editor instances and builds
rm -rf ${ES_BUILD_LOCATION}/*
echo Old builds cleaned.
Expand Down Expand Up @@ -27,4 +32,4 @@ node ./src/server.js &
cron

# wait for them all
wait -n
wait -n
2 changes: 1 addition & 1 deletion xtext/static.xtext/public/xtext_tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{"name":"language", "type":"text"}],

"returnType": "text",
"path": "http://127.0.0.1:9000"
"path": "{{BASE-URL}}:9000"
}
],

Expand Down