firewebkit-cli
v1.0.10
Published
CLI tool for your firewebkit account
Downloads
17
Readme
Installation
npm -g i firewebkit-cli
yarn global add firewebkit-cli
Usage
firewebkit <command> [parameters]
Commands
- login
- rlogin
- logout
- open
- whoami
- test
- logs
- create-project
- init
- create-function
- create-db
- create-site
- connect-domain
- deploy-site
- deploy-function
- deploy-db
- upload-media
- delete-media
Details
login
Log in to your account.
Notes:
- You must have
login.cli
signature. - If you want to log out of all the CLI sessions at once, simply delete this signature.
- You can disable CLI logins by not having
login.cli
signature - Non permanent logins expire in 24 hours (AEST)
- Refresh tokens are valid for 30 days and renewed every time
refresh-login
is run.
Optional parameters:
--email <email address>
--permanent
– Permanently login that does not require refresh token.--ssh-key
– SSH private key to log in without password--passphrase
– Ask for passphrase for encrypted private key (only applicable when--ssh-key
option provided)--signature <signature>
– Use custom signature name instead oflogin.cli
. The signature must be enabled for CLI authentication. You can enable it from settings page. Once you have logged in, changing the CLI authentication status will not revoke the tokens. You will need to deactivate the signature to disable the logged in sessions.
rlogin
Refreshes the non-permanent session. The request must be made within 30 days of login
or last rlogin
commands. If the refresh token is expired or login.cli
signature is revoked, you will need to re-login
Optional parameters:
--passphrase
– Ask for passphrase for encrypted private key (only applicable when the original login was using encrypted SSH key, i.e, via--ssh-key
option)
logout
Log out of your account.
open
Open the project in your default browser if it's available. You must have access to the project for this command to work.
whoami
Print currently logged in user information.
Optional parameters:
--raw
– Print just logged in email address.
test
Tests connection for current project
Optional parameters:
--details
– Print details if connection fails
logs
Stream or download the logs from your function box
Optional parameters:
--tail <number>
- Number of lines to start with--notail
- Do not request any lines to start with (Similar to--tail 0
)--download <filename>
- Save the file instead of streaming to the specified file--verbose
--group
- Function box group to stream--console
- Stream console logs as well--system
- Stream system logs as well--no-default
- Do not stream default logger logs--old
- Download / stream archived logs
create-project
Create a project
Optional parameters:
--token <token>
--name <project name>
--domain <primary domain>
--username <project username>
init
Initializes a project and create relevant directories.
Optional parameters:
--project-id <project ID>
--services <[Hosting,Functions,...]>
--site-source <source directory>
--site-target <site target>
--site-name <site name>
create-function
Initialize function from one of the available templates.
Alias for this command is create-fn
Optional parameters:
--template <template name>
--name <function name>
--description <description>
--trigger <trigger name>
--trigger-value <trigger value>
create-site
Create new hosting site
Optional parameters:
--token <token>
--name <site name>
--target <site target>
connect-domain
Connect new domain to the specified site. The site must already exist. See create-site
command.
Optional parameters:
--token <token>
--site-name <Site name>
--domain <FQDN>
deploy-site
Deploys the site
Optional parameters:
--token <token>
--message <message>
--verbose
If you want to ignore a file, you can use hosting.ignore
array in firewebkit.json
or create .firewebkitignore
file with glob pattern per line.
deploy-function
Deploys single function from firewebkit.json
Alias for this command is deploy-fn
and deployfn
Required parameters:
--name <function name>
Optional parameters:
--token <token>
--message <message>
--version <new version>
--verbose
--no-deps
Confirm deploy without dependencies--reset
Reset the associated container group after successful deploy
If you want to ignore a file, you can use functions.list[*].ignore
array in firewebkit.json
or create .firewebkitignore
file with glob pattern per line.
deploy-db
Deployes single data table from firewebkit.json
Required parameters:
--name <data table name>
Optional parameters:
--token <token>
--verbose
--create-new
--confirm-data-loss
create-db
Creates new data table and add it to firewebkit.json
Optional parameters:
--token <token>
--name <Data table name>
--title <Data table title>
--public-access
--schema-file <json file>
--ui-schema-file <json file>
--options-file <json file>
--verbose
--confirm-data-loss
upload-media
Upload media files
Required parameters:
--file <media file path> --file <more>
Optional parameters:
--token <token>
--verbose
--variants 150,64
- Create variants of specified sizes--dir <dir path>
- Subdirectory to upload to--keep-names
- Keep original file names instead of random generated names--skip-cdn
- Do not save the file/s to CDN (if CDN is enabled on the account)
delete-media
Delete single media file (and their respective variants if available)
Required parameters:
--id <media ID>
Optional parameters:
--token <token>
--verbose
Config
Although you shouldn't worry about config file structure because this CLI will take care of it, nevertheless, some people are interested in how it is structured.
{
"projectId": "<project_id>",
"hosting": {
"target": "<target>",
"name": "<definitive name>",
"source": "build",
"ignore": [
"README.md"
]
},
"functions": {
"source": "functions",
"list": [
{
"name": "<public name of function>",
"module": "<module name in source>",
"trigger": "HTTP|HTTP_WITH_AUTH|HTTP_WITH_SCOPED_AUTH|SCHEDULE",
"triggerValue": "GET|POST|PUT|DELETE|ANY|<cron expression>",
"timeout": <timeout in seconds (<=30)>,
"overwrite": true|false,
"alwaysUseLatest": true|false,
"group": 1,
"ignore": [
"README.md",
"docs/*.md"
]
}
]
},
"dataTables": [
{
"name": "weekly_programs",
"title": "Weekly Programs",
"publicAccess": true,
"icon": "CalendarAlt",
"schemaFile": "db/weekly.schema.json",
"uiSchemaFile": "db/weekly.uischema.json",
"optionsFile": "db/weekly.options.json"
}
]
}
License
Copyright (c) 2020-present Amrayn Web Services
https://firewebkit.com
https://amrayn.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.