Skip to content

Commit

Permalink
Support multi themes
Browse files Browse the repository at this point in the history
Add .env file for launch docker-compose, support Variable environment
variables;
User can add custom theme folder, and change it in Makefile;

Change-Id: Icdff4c926e7b72c41223797c116d19d338f3215b
Signed-off-by: Haitao Yue <hightall@me.com>
  • Loading branch information
hightall committed Jan 17, 2017
1 parent c8672b5 commit 7f3682e
Show file tree
Hide file tree
Showing 44 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
STATIC_FOLDER=
TEMPLATE_FOLDER=
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ target/
celerybeat-schedule

# dotenv
.env
#.env

# virtualenv
venv/
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ WHITE := $(shell tput -Txterm setaf 7)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)

STATIC_FOLDER?=themes\/react\/static
TEMPLATE_FOLDER?=themes\/react\/templates

.PHONY: \
all \
check \
Expand Down Expand Up @@ -32,7 +35,12 @@ logs:
redeploy: ##@Service Redeploy single service, Use like "make redeploy service=dashboard"
bash scripts/redeploy.sh ${service}

initial-env: ##@Configuration Initial Configuration for dashboard
sed -i 's/\(STATIC_FOLDER=\).*/\1${STATIC_FOLDER}/' .env
sed -i 's/\(TEMPLATE_FOLDER=\).*/\1${TEMPLATE_FOLDER}/' .env

start: ##@Service Start service
@$(MAKE) initial-env
bash scripts/start.sh

stop: ##@Service Stop service
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ services:
- MONGO_DB=dev
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- STATIC_FOLDER=$STATIC_FOLDER
- TEMPLATE_FOLDER=$TEMPLATE_FOLDER
expose:
- "8080"
volumes: # This should be removed in product env
Expand Down
4 changes: 3 additions & 1 deletion src/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
bp_cluster_view, bp_cluster_api, \
bp_host_view, bp_host_api

app = Flask(__name__, static_folder='static', template_folder='templates')
STATIC_FOLDER = os.getenv("STATIC_FOLDER", "themes/basic/static")
TEMPLATE_FOLDER = os.getenv("TEMPLATE_FOLDER", "themes/basic/templates")
app = Flask(__name__, static_folder=STATIC_FOLDER, template_folder=TEMPLATE_FOLDER)

app.config.from_object('config.DevelopmentConfig')
app.config.from_envvar('CELLO_CONFIG_FILE', silent=True)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7f3682e

Please sign in to comment.