Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 7689dd4

Browse files
committed
Fix discrepencies with master
1 parent bd748ed commit 7689dd4

File tree

3 files changed

+64
-3
lines changed

3 files changed

+64
-3
lines changed

bin/csbe-setup-sandbox

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
# desc# reset local sandbox in one of several configs
4+
5+
function usage {
6+
echo "usage:
7+
8+
`basename $0` --unified-cfg-file
9+
`basename $0` --store-cfg-in-mongo [--init-with-unified <cfgName>]
10+
11+
Setup sandbox configuration for any number of scenarios. Following the execution
12+
of this script, you will need to quit your shells and fire up new ones.
13+
14+
The order options are specified on the command line matters. The most significant,
15+
list in the usage statuements above, needs to be first.
16+
17+
--unified-cfg-file
18+
Remove any sandbox options which will setup for use with the config files deployed
19+
via 'dt-update-secrets'. The config will be loaded from a file. It will not be
20+
stored in mongo.
21+
22+
This will set the CSSVC_CFG_FILE variable according to the unified config process:
23+
https://github.com/TeamCodeStream/codestream-server/blob/develop/api_server/docs/unified-cfg-file.md
24+
25+
--store-cfg-in-mongo [--init-with-unified <cfgName>]
26+
Store config in mongo initialized with open-development.json (most basic config). This will
27+
set the CSSVC_CFG_URL env variable to your local mongo codestream database. When starting
28+
the api with an empty database, it will initially load a config based on the additional
29+
args.
30+
31+
The default (no additional args) is to initialize it from api_server/etc/configs/open-development.json.
32+
--init-with-unified will find the named config file (eg. onprem-development, codestream-cloud,
33+
onprem-development-custom, ...) that matches the repos' schema version and use that.
34+
"
35+
exit 1
36+
}
37+
38+
function store_cfg_in_mongo {
39+
echo "CSSVC_CFG_URL=mongodb://localhost/codestream" >$CSBE_SANDBOX/sb.options
40+
[ "$1" == "--init-with-unified" -a -n "$2" ] && echo "CSSVC_CONFIGURATION=$2" >>$CSBE_SANDBOX/sb.options
41+
echo "Sandbox options:"
42+
cat $CSBE_SANDBOX/sb.options
43+
}
44+
45+
[ "$CSBE_ENV" != "local" ] && echo "This script only works for mono-repo local development" && exit 1
46+
[ -z "$1" ] && usage
47+
48+
while [ "$#" -gt 0 ]; do
49+
case "$1" in
50+
--unified-cfg-file) { [ -f $CSBE_SANDBOX/sb.options ] && rm -f $CSBE_SANDBOX/sb.options; }; echo "$CSBE_SANDBOX/sb.options removed"; exit;;
51+
--store-cfg-in-mongo) shift; store_cfg_in_mongo "$@"; exit;;
52+
*) usage;;
53+
esac
54+
done

onprem_admin/src/store/reducers/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export default (state = null, action) =>
6262
return action.payload;
6363
case Actions.CONFIG_SET_DOTTED_PROPERTY:
6464
dotPropertyInit(draft, action.payload.property, action.payload.value);
65-
if (action.payload.updateEmailSettings) emailConfigurationUpdate(draft);
65+
if (action.payload.updateEmailSettings) emailConfigurationUpdate(draft, action.payload);
6666
console.debug(`CONFIG_SET_DOTTED_PROPERTY action = `, action);
6767
// console.debug('***DRAFT=', JSON.stringify(draft.emailDeliveryService, null, 2));
6868
break;
6969
case Actions.CONFIG_TOGGLE_DOTTED_BOOLEAN:
7070
const propVal = getDottedProperty(draft, action.payload.property) || false;
7171
dotPropertyInit(draft, action.payload.property, !propVal);
72-
if (action.payload.updateEmailSettings) emailConfigurationUpdate(draft);
72+
if (action.payload.updateEmailSettings) emailConfigurationUpdate(draft, action.payload);
7373
if (action.payload.updateSslConfig) sslConfigurationUpdate(draft);
7474
console.debug(`CONFIG_TOGGLE_DOTTED_BOOLEAN action = `, action);
7575
// console.debug('***DRAFT=', JSON.stringify(draft.emailDeliveryService, null, 2));

sandbox/shared/sandbox_config.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ function sbcfg_initialize {
7373
[ -z "$sbAssetEnv" ] && sbcfg_set_var "${sbPrefix}_ASSET_ENV" "local"
7474

7575
# ---- CONFIG
76+
7677
if [ -n "$CSSVC_CFG_URL" ]; then
7778
# ---- config stored in mongo
78-
echo "CSSVC_CFG_URL=$CSSVC_CFG_URL"
79+
# for local development only, CSSVC_CONFIGURATION indicates config file to use for initialization
80+
if [ "$CSSVC_ENV" = "local" -a -n "$CSSVC_CONFIGURATION" -a -n "$CS_API_SANDBOX" ]; then
81+
sandutil_get_codestream_cfg_file "$CS_API_SANDBOX" "$CSSVC_CONFIGURATION" "$CSSVC_ENV" "" noReport
82+
export CS_API_DEFAULT_CFG_FILE=$CSSVC_CFG_FILE
83+
unset CSSVC_CFG_FILE
84+
[ -z "$CS_API_DEFAULT_CFG_FILE" ] && echo "WARN: could not find a config for initialization (using $CSSVC_CONFIGURATION)." || echo "CS_API_DEFAULT_CFG_FILE=$CS_API_DEFAULT_CFG_FILE"
85+
fi
7986
else
8087
# ---- config file
8188
[ -n "$sbCfgFile" ] && configParm=$sbCfgFile || configParm="$CSSVC_CONFIGURATION"

0 commit comments

Comments
 (0)