Skip to content

Commit 8df616e

Browse files
committed
Added config.js
Attempting to make UI more flexible (and not broken) for different usage scenarios: Like using the service through a reverse proxy
1 parent e92feb4 commit 8df616e

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ deployment:
1313
- cp js/bootstrap.min.js /tmp/ui/js
1414
- cp js/jquery.min.js /tmp/ui/js
1515
- cp index.html /tmp/ui/index.html
16+
- cp config.js /tmp/ui/config.js
1617
- cd /tmp; zip -r9 $CIRCLE_ARTIFACTS/centralconfig-ui.zip ui
1718
- go get github.com/tcnksm/ghr
1819
- ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME v1.0.$CIRCLE_BUILD_NUM $CIRCLE_ARTIFACTS/ || true

config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var appconfig = {
2+
"serviceBaseUrl" : "" /* Leave blank for localhost/local service port */
3+
}

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939

4040
</div>
4141

42+
<!-- Application configuration
43+
================================================== -->
44+
<script type="text/javascript" src="config.js"></script>
45+
4246
<!-- Bootstrap core JavaScript
4347
================================================== -->
4448
<!-- Placed at the end of the document so the pages load faster -->

js/utils/CentralConfigAPIUtils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CentralConfigAPIUtils {
1414
getAllConfigItems(){
1515

1616
// Format the url
17-
let url = `/config/getall`;
17+
let url = `${appconfig.serviceBaseUrl}/config/getall`;
1818

1919
console.time("Fetched config data");
2020
nprogress.start();
@@ -38,7 +38,7 @@ class CentralConfigAPIUtils {
3838
removeConfigItem(configItem){
3939

4040
// Format the url
41-
let url = `/config/remove`;
41+
let url = `${appconfig.serviceBaseUrl}/config/remove`;
4242

4343
console.log("Removing config: %O", configItem)
4444
console.time("Called remove");
@@ -64,7 +64,7 @@ class CentralConfigAPIUtils {
6464
setConfigItem(configItem){
6565

6666
// Format the url
67-
let url = `/config/set`;
67+
let url = `${appconfig.serviceBaseUrl}/config/set`;
6868

6969
console.log("Setting config: %O", configItem)
7070
console.time("Set config data");

0 commit comments

Comments
 (0)