Skip to content

Commit

Permalink
feat: let users choose token creation from flag (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko authored Oct 2, 2019
1 parent 2cd544e commit 30624f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/features/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ module.exports = async function() {
storage
});

return (await require("./tokens"))();
if (process.env.NITRO_STORAGE_GENERATE_TOKEN) {
return (await require("./tokens"))();
}
return true;
};
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ console.log(prettyFont.string);
const options: NitroInitOptions = {};

if (requetedServices) {
options.requetedServices = requetedServices.split(',').filter(feat => feat);
options.requetedServices = requetedServices.split(",").filter(feat => feat);
}

return (await require(`./commands/${commandName}`))(options);
Expand All @@ -41,16 +41,20 @@ console.log(prettyFont.string);
.option("-f, --force", "override all confirmations", false)
.option("-r, --relogin", "force login", false)
.option("-c, --create", "enable resource creation", true)
.option("-s, --sas", "use SAS token (only: storage and database)", false)
.option("-m, --manual", "enable Manual mode", false)
.option("-d, --debug", "enable debug mode", false)
.option("-s, --sas", "use SAS token (only: storage and database)", false)
.option("-t, --token", "generate a Storage token into a .env file", false)
.option("-j, --just <services>", "setup or deploy only the selected services (e.g. --just functions,hosting)", false)
.option("--yolo", "enable all modes and all services", false)
.parse(process.argv);

// set confiuration
// WARNING: order matters
if (program.yolo) {
program.force = true;
program.auto = true;
program.token = true;
process.env.HEXA_YOLO_MODE = "1";
}

Expand All @@ -71,6 +75,10 @@ console.log(prettyFont.string);
}
if (program.sas) {
process.env.NITRO_STORAGE_USE_SAS = "1";
program.token = true;
}
if (program.token) {
process.env.NITRO_STORAGE_GENERATE_TOKEN = "1";
}

// use process.argv not program.argv
Expand Down

0 comments on commit 30624f3

Please sign in to comment.