factor-work/bonerbonerboner/services/services.factor

21 lines
583 B
Factor
Raw Normal View History

2021-04-04 11:10:32 -04:00
! Copyright (C) 2020 .
! See http://factorcode.org/license.txt for BSD license.
2022-01-24 08:10:31 -05:00
USING: kernel fry db db.pools db.sqlite environment math.parser io.pathnames ;
2021-04-04 11:10:32 -04:00
IN: bonerbonerboner.services
CONSTANT: bbb-default-port 8069
2021-04-11 23:04:12 -04:00
: bbb-data-directory ( -- path )
home ".bonerbonerboner" append-path ;
2022-01-24 08:10:31 -05:00
: <bbb-sqlite-db> ( -- db-pool )
bbb-data-directory "bbb.db" append-path <sqlite-db> <db-pool> ;
2021-04-11 23:04:12 -04:00
2021-04-04 11:10:32 -04:00
: with-bbb-db ( quot -- )
2022-01-24 08:10:31 -05:00
'[ <bbb-sqlite-db> _ with-pooled-db ] call ; inline
2021-04-04 11:10:32 -04:00
: bbb-api-port ( -- port )
"BBB_API_PORT" os-env [ string>number ] [ bbb-default-port ] if* ;