fix: read forgejo hsot from env
This commit is contained in:
parent
c868552e41
commit
7893d0a3eb
3 changed files with 7 additions and 4 deletions
|
@ -18,6 +18,7 @@ steps:
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DATABASE_URL: postgres://postgres:password@database:5432/postgres
|
POSTGRES_DATABASE_URL: postgres://postgres:password@database:5432/postgres
|
||||||
SQLITE_DATABASE_URL: sqlite:///tmp/admin.db
|
SQLITE_DATABASE_URL: sqlite:///tmp/admin.db
|
||||||
|
FORGEJO_HOST: http://forgejo:3000
|
||||||
commands:
|
commands:
|
||||||
# - curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
|
# - curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
|
||||||
# - apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
|
# - apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
|
||||||
|
|
|
@ -31,6 +31,7 @@ pub mod schema;
|
||||||
const REPO_SEARCH_PATH: &str = "/api/v1/repos/search";
|
const REPO_SEARCH_PATH: &str = "/api/v1/repos/search";
|
||||||
const GITEA_NODEINFO: &str = "/api/v1/nodeinfo";
|
const GITEA_NODEINFO: &str = "/api/v1/nodeinfo";
|
||||||
const GITEA_IDENTIFIER: &str = "gitea";
|
const GITEA_IDENTIFIER: &str = "gitea";
|
||||||
|
const FORGEJO_IDENTIFIER: &str = "forgejo";
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Gitea {
|
pub struct Gitea {
|
||||||
|
@ -177,13 +178,13 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub const GITEA_HOST: &str = "http://localhost:8080";
|
|
||||||
pub const NET_REPOSITORIES: u64 = 100;
|
pub const NET_REPOSITORIES: u64 = 100;
|
||||||
pub const PER_CRAWL: u64 = 10;
|
pub const PER_CRAWL: u64 = 10;
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn gitea_works() {
|
async fn gitea_works() {
|
||||||
let ctx = Gitea::new(Url::parse(GITEA_HOST).unwrap(), Client::new());
|
let ctx = Gitea::new(Url::parse(&std::env::var("FORGEJO_HOST").unwrap()).unwrap(), Client::new());
|
||||||
|
|
||||||
assert!(ctx.is_forge().await);
|
assert!(ctx.is_forge().await);
|
||||||
let steps = NET_REPOSITORIES / PER_CRAWL;
|
let steps = NET_REPOSITORIES / PER_CRAWL;
|
||||||
|
|
||||||
|
|
|
@ -229,13 +229,14 @@ mod tests {
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub const GITEA_HOST: &str = "http://localhost:8080";
|
|
||||||
pub const GITEA_USERNAME: &str = "bot";
|
pub const GITEA_USERNAME: &str = "bot";
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn crawl_gitea() {
|
async fn crawl_gitea() {
|
||||||
let (db, ctx, federate, _tmp_dir) = sqlx_sqlite::get_ctx().await;
|
let (db, ctx, federate, _tmp_dir) = sqlx_sqlite::get_ctx().await;
|
||||||
let url = Url::parse(GITEA_HOST).unwrap();
|
let url = Url::parse(
|
||||||
|
&std::env::var("FORGEJO_HOST").unwrap()
|
||||||
|
).unwrap();
|
||||||
ctx.crawl(&url, &db, &federate).await;
|
ctx.crawl(&url, &db, &federate).await;
|
||||||
// let hostname = get_hostname(&Url::parse(GITEA_HOST).unwrap());
|
// let hostname = get_hostname(&Url::parse(GITEA_HOST).unwrap());
|
||||||
assert!(db.forge_exists(&url).await.unwrap());
|
assert!(db.forge_exists(&url).await.unwrap());
|
||||||
|
|
Loading…
Reference in a new issue