Adding the ability to change default logo URL for new apps in self hosting.

This commit is contained in:
mike12345567 2020-12-14 15:56:33 +00:00
parent 0e854473f0
commit 2546346f36
6 changed files with 22 additions and 6 deletions

View File

@ -10,9 +10,10 @@ services:
environment:
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
SELF_HOSTED: ${SELF_HOSTED}
SELF_HOSTED: 1
COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984
BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT}
LOGO_URL: ${LOGO_URL}
depends_on:
- nginx-service
- minio-service

View File

@ -1,6 +1,6 @@
SELF_HOSTED=1
MINIO_ACCESS_KEY=budibase
MINIO_SECRET_KEY=budibase
COUCH_DB_PASSWORD=budibase
COUCH_DB_USER=budibase
BUDIBASE_ENVIRONMENT=PRODUCTION
LOGO_URL=https://logoipsum.com/logo/logo-15.svg

View File

@ -1,3 +1,5 @@
const { getLogoUrl } = require("../utilities")
const BASE_LAYOUT_PROP_IDS = {
PRIVATE: "layout_private_master",
PUBLIC: "layout_public_master",
@ -88,8 +90,7 @@ const BASE_LAYOUTS = [
active: {},
selected: {},
},
logoUrl:
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg",
logoUrl: getLogoUrl(),
title: "",
backgroundColor: "",
color: "",

View File

@ -1,5 +1,6 @@
const { BUILTIN_ROLE_IDS } = require("../utilities/security/roles")
const { BASE_LAYOUT_PROP_IDS } = require("./layouts")
const { getLogoUrl } = require("../utilities")
exports.createHomeScreen = () => ({
description: "",
@ -138,8 +139,7 @@ exports.createLoginScreen = app => ({
active: {},
selected: {},
},
logo:
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg",
logo: getLogoUrl(),
title: `Log in to ${app.name}`,
buttonText: "Log In",
_children: [],

View File

@ -39,6 +39,7 @@ module.exports = {
// self hosting features
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
LOGO_URL: process.env.LOGO_URL,
_set(key, value) {
process.env[key] = value
module.exports[key] = value

View File

@ -168,3 +168,16 @@ exports.coerceRowValues = (row, table) => {
}
return clonedRow
}
/**
* Gets the correct link to the logo URL depending on if running in Cloud or if running in self hosting.
* @returns {string} A URL which links to the correct default logo for new apps.
*/
exports.getLogoUrl = () => {
const BB_LOGO_URL =
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"
if (env.SELF_HOSTED) {
return env.LOGO_URL || BB_LOGO_URL
}
return BB_LOGO_URL
}