Skip to content

Commit

Permalink
Merge pull request #2999 from c2corg/docker-build-url-config
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobesson authored Oct 19, 2022
2 parents 2ce748f + 5fde56c commit b5eaae6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ config.setUrlsName = function (name) {

const urlsName = window.localStorage.getItem(LOCAL_STORAGE_KEY) ?? config.urls.name;

if (!config.isProduction) {
if (config.isBackendSelectable) {
config.urls = config.urlsConfigurations[urlsName];
} else if (location.hostname === 'www.demov6.camptocamp.org') {
// production builds use production urls by default.
// use hostname to set urls for demo
config.urls = config.urlsConfigurations['demo'];
}

export default config;
4 changes: 2 additions & 2 deletions src/views/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
</div>

<div
v-if="!siteConfiguration.isProduction"
v-if="siteConfiguration.isBackendSelectable"
class="navigation-item is-hidden-mobile"
:title="'This page may contains bugs or incomplete features'"
>
<fa-icon icon="bug" size="lg" class="has-text-danger" />
</div>

<div v-if="!siteConfiguration.isProduction" class="navigation-item dropdown is-hoverable is-hidden-mobile">
<div v-if="siteConfiguration.isBackendSelectable" class="navigation-item dropdown is-hoverable is-hidden-mobile">
<div class="dropdown-trigger">
<fa-icon icon="database" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/document/utils/boxes/CommentsBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const computeCooked = function (cooked) {
};
export default {
isProduction: config.isProduction,
isProduction: config.urls.name === 'prod',
mixins: [requireDocumentProperty, viewModeMixin],
Expand Down
4 changes: 2 additions & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const config = {
ignApiKey: undefined,
bingApiKey: undefined,
ordnanceSurveyApiKey: 'eUaDulZ6AqXJo7iyoP2lRsgUjKfZWA71',
isProduction: false,
isBackendSelectable: true,
addthisPublicId: 'ra-58abf6b4f3a680cb',
googleAnalyticsKey: 'UA-2814179-1',
urlsConfigurations: {
Expand Down Expand Up @@ -158,7 +158,7 @@ if (process.env.BUILD_ENV === 'local' || process.env.BUILD_ENV === undefined) {
config.ignApiKey = '1qdmi4d0spl50eef78ftvm3j';
config.bingApiKey = 'AudizIfCd3NAdt91ubJMGkMI-swfHxe1R-_U7KiLxCHqepDy70txQ-_-89_eevxc';

config.isProduction = true; // explicit prod flag
config.isBackendSelectable = false; // explicit flag

// set a warning if bundle size is too big
result.configureWebpack.performance.hints = 'warning';
Expand Down

0 comments on commit b5eaae6

Please sign in to comment.