Commit Graph

13 Commits

Author SHA1 Message Date
Joris Vink e98a4ddab5 Change how routes are configured in Kore.
Routes are now configured in a context per route:

route /path {
	handler handler_name
	methods get post head
	validate qs:get id v_id
}

All route related configurations are per-route, allowing multiple
routes for the same path (for different methods).

The param context is removed and merged into the route context now
so that you use the validate keyword to specify what needs validating.
2021-09-15 11:09:52 +02:00
Joris Vink 4e2ca90095 Move Kore hook functions to kore/hooks.h. 2021-01-11 23:58:26 +01:00
Joris Vink ce360e15d6 Update examples with latest single binary changes.
- Use kore_default_getopt() to let Kore do all argument parsing
  for the examples. They don't do any option parsing themselves.
2020-10-08 20:26:11 +02:00
Joris Vink f6cd16c567 Replace static/dynamic with a single option: route
Kore will automatically detect if a route is a dynamic or static one
so there is no need for the configuration options to differ anymore.
2019-11-15 08:11:02 +01:00
Joris Vink 46375303cb Allow multiple binds on new server directive. 2019-09-27 20:00:35 +02:00
Joris Vink 7350131232 Allow listening of tls/notls ports at the same time.
Before kore needed to be built with NOTLS=1 to be able to do non TLS
connections. This has been like this for years.

It is time to allow non TLS listeners without having to rebuild Kore.

This commit changes your configuration format and will break existing
applications their config.

Configurations now get listener {} contexts:

listen default {
	bind 127.0.0.1 8888
}

The above will create a listener on 127.0.0.1, port 8888 that will serve
TLS (still the default).

If you want to turn off TLS on that listener, specify "tls no" in that
context.

Domains now need to be attached to a listener:

Eg:
	domain * {
		attach	default
	}

For the Python API this kills kore.bind(), and kore.bind_unix(). They are
replaced with:

	kore.listen("name", ip=None, port=None, path=None, tls=True).
2019-09-27 12:27:04 +02:00
Joris Vink fcc044af87 change all domain directives to * in examples. 2017-09-19 15:16:02 +02:00
Joris Vink 175b2e2c9b kore flavor -> kodev flavor 2017-03-06 23:18:16 +01:00
Joris Vink f1d33ab91b kore -> kodev where appropriate 2017-03-06 11:00:53 +01:00
Joris Vink 3e84502235 Adjust examples after recent changes.
- New kodev tool generates config with server.pem/key.pem.
- Use proper formats for kore_log().
- Update to new websocket api.
2017-02-25 17:02:39 -08:00
Joris Vink c5ce707a91 Introduce build flavors.
Kore applications now get a build.conf which may contain different
build flavors. Each flavor can get its own cflags or ldflags.

This was in parts inspired by #106.

A new cli command has been added:
kore flavor

This command allows you to see all flavors and switch between them.
The kore build command now also takes a -v argument which if given
dumps the used CFLAGS and LDFLAGS out to stdout.

For existing applications the build.conf is automatically generated
next time you run kore build or kore run.

Also fixed a bug in the json_yajl example, sneaky change here.
2016-01-27 21:29:59 +01:00
Joris Vink d8508f4a7b Add the actual task changes for last commit. 2015-07-01 11:03:54 +02:00
Joris Vink cf94a53be7 Add user callbacks for task activity.
Allows one to bind a callback to a Kore task which is called
everytime activity happens on the task channel.

Add an example as well on how this works.

Inspired by issue #68.
2015-07-01 11:01:23 +02:00