Skip to content

Commit

Permalink
add guidelines for running the project locally
Browse files Browse the repository at this point in the history
Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
  • Loading branch information
sajjadsabzkar and amiremohamadi committed Oct 29, 2024
1 parent c43af64 commit 1ab1a7a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ config-upload: ## upload config to kv storage. "name" arg should be provided
.PHONY: prepare
prepare: ## prepare developing environment
@ sed -i -e "s/KV_BINDING/$(KV_BINDING)/" -e "s/KV_ID/$(KV_ID)/" wrangler.toml

.PHONY: dev-config
dev-config: ## write config locally
@ npx wrangler kv:key put CONFIG --path=$(name) --binding $(KV_BINDING) --local

.PHONY: dev
dev: prepare ## run the project locally
@ npx wrangler dev --port 8780 --var BUCKET:$(KV_BINDING) TOKEN:$(TOKEN)
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,28 @@ $ make config-upload
```sh
$ make deploy
```

## Run Locally
To run the bot locally, first:
1. After you creating .env file Prepare your developing environment by (if you didn't run this command ever):
```sh
$ make prepare
```
2. you need to write a local configuration file by using:
```sh
$ make dev-config name=config-example.toml
```
3. to run wiseass locally:
```sh
$ make dev
```
4. install [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/) and run the following command to expose your local wiseass instance to the internet.

```sh
$ cloudflared tunnel --url http://localhost:8780
```

5. set a telegram webhook:
```
https://api.telegram.org/bot{YOUR_BOT_TOKEN}/setWebhook?url=https://{CLOUDFLARED_EXPOSED_BASE_URL}/updates
```

0 comments on commit 1ab1a7a

Please sign in to comment.