@@ -12,7 +12,7 @@ const { proxyCreateFunctionRule, proxyCreateSiteRule, proxyListRules } = require
1212const { consoleVariables } = require('./console');
1313const { sdkForConsole } = require('../sdks')
1414const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsGetDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions');
15- const { sitesGet, sitesCreate, sitesUpdate, sitesCreateDeployment, sitesGetDeployment, sitesListVariables, sitesCreateVariable } = require('./sites');
15+ const { sitesGet, sitesCreate, sitesUpdate, sitesCreateDeployment, sitesGetDeployment, sitesCreateVariable } = require('./sites');
1616const {
1717 databasesGet,
1818 databasesCreate,
@@ -1011,7 +1011,7 @@ const pushSettings = async () => {
10111011 }
10121012}
10131013
1014- const pushSite = async({ siteId, async, code, withVariables } = { returnOnZero: false }) => {
1014+ const pushSite = async({ siteId, async, code } = { returnOnZero: false }) => {
10151015 process.chdir(localConfig.configDirectoryPath)
10161016
10171017 const siteIds = [];
@@ -1177,38 +1177,16 @@ const pushSite = async({ siteId, async, code, withVariables } = { returnOnZero:
11771177 }
11781178 }
11791179
1180- if (withVariables) {
1181- updaterRow.update({ status: 'Updating variables' }).replaceSpinner(SPINNER_ARC);
1180+ updaterRow.update({ status: 'Creating variables' }).replaceSpinner(SPINNER_ARC);
11821181
1183- const { variables } = await paginate(sitesListVariables, {
1182+ await Promise.all((site['vars'] ?? []).map(async variable => {
1183+ await sitesCreateVariable({
11841184 siteId: site['$id'],
1185+ key: variable['key'],
1186+ value: variable['value'],
11851187 parseOutput: false
1186- }, 100, 'variables');
1187-
1188- await Promise.all(variables.map(async variable => {
1189- await sitesDeleteVariable({
1190- siteId: site['$id'],
1191- variableId: variable['$id'],
1192- parseOutput: false
1193- });
1194- }));
1195-
1196- let result = await awaitPools.wipeVariables(site['$id']);
1197- if (!result) {
1198- updaterRow.fail({ errorMessage: `Variable deletion timed out.` })
1199- return;
1200- }
1201-
1202- // Deploy local variables
1203- await Promise.all((site['vars'] ?? []).map(async variable => {
1204- await sitesCreateVariable({
1205- siteId: site['$id'],
1206- key: variable['key'],
1207- value: variable['value'],
1208- parseOutput: false
1209- });
1210- }));
1211- }
1188+ });
1189+ }));
12121190
12131191 if (code === false) {
12141192 successfullyPushed++;
@@ -2051,7 +2029,6 @@ push
20512029 .option(`-f, --site-id <site -id >`, `ID of site to run`)
20522030 .option(`-A, --async`, `Don't wait for sites deployments status`)
20532031 .option("--no-code", "Don't push the site's code")
2054- .option("--with-variables", `Push site variables.`)
20552032 .action(actionRunner(pushSite));
20562033
20572034push
0 commit comments