Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions templates/cli/lib/commands/generic.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const client = new Command("client")
parse(config)
}

if (endpoint) {
if (endpoint !== undefined) {
try {
let url = new URL(endpoint);
if (url.protocol === "http:" || url.protocol === "https:") {
Expand All @@ -77,19 +77,19 @@ const client = new Command("client")
}
}

if (key) {
if (key !== undefined) {
globalConfig.setKey(key)
}

if (projectId) {
if (projectId !== undefined) {
localConfig.setProject(projectId, '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the second parameter used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setProject(projectId, projectName)
Its the project name

}

if (selfSigned == true || selfSigned == false) {
globalConfig.setSelfSigned(selfSigned);
}

if (reset) {
if (reset !== undefined) {
globalConfig.setEndpoint("");
globalConfig.setKey("");
globalConfig.setCookie("");
Expand Down
3 changes: 1 addition & 2 deletions templates/cli/lib/commands/init.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ const initFunction = async () => {
git remote add -f origin https://github.com/{{ sdk.gitUserName }}/functions-starter && \
git config core.sparseCheckout true && \
echo '${answers.runtime.id}' >> .git/info/sparse-checkout && \
git pull origin dev && \
git checkout dev && \
git pull origin main && \
rm -rf .git && \
mv ${answers.runtime.id}/* . && \
rm -rf ${answers.runtime.id}`;
Expand Down
12 changes: 6 additions & 6 deletions templates/cli/lib/sdks.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ const sdkForProject = async () => {
.setSelfSigned(selfSigned)
.setLocale("en-US");

if (key) {
if (cookie) {
return client
{% if sdk.test != "true" %}
.setKey(key)
.setMode("default");
.setCookie(cookie)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a new setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i just changed the order, to give higher preference to cookies that an API key

.setMode("admin");
{% endif %}
}

if (cookie) {
if (key) {
return client
{% if sdk.test != "true" %}
.setCookie(cookie)
.setMode("admin");
.setKey(key)
.setMode("default");
{% endif %}
}

Expand Down