Skip to content

Commit

Permalink
adds hosted docs site
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-skobov committed Jun 25, 2023
1 parent 1951432 commit f08b19e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hosted/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hosted directory

This directory is where I keep all hira code related to deploying infrastructure. For example, the hira public documentation site is defined here.
1 change: 1 addition & 0 deletions hosted/hiracliwebsite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hira
17 changes: 17 additions & 0 deletions hosted/hiracliwebsite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "hiracliwebsite"
version = "0.1.0"
edition = "2021"


[dependencies]
hira = { path = "../../hira" }
dotenv_reader = { path = "../../level2/dotenv_reader" }
aws_cfn_stack = { path = "../../level2/aws_cfn_stack" }
aws_s3 = { path = "../../level2/aws_s3" }
aws_cloudfront_distribution = { path = "../../level2/aws_cloudfront_distribution" }
# third party dependencies can be added via extern crate:
#iam = { git = "https://github.com/nikita-skobov/aws_cfn_type_gen", rev = "66daeace6fbf11761026201728131bd9c668210b" }
#cloud_front = { git = "https://github.com/nikita-skobov/aws_cfn_type_gen", rev = "66daeace6fbf11761026201728131bd9c668210b" }
cfn_resources = { git = "https://github.com/nikita-skobov/aws_cfn_type_gen", rev = "66daeace6fbf11761026201728131bd9c668210b" }
tokio = { version = "*", features = ["full"]}
50 changes: 50 additions & 0 deletions hosted/hiracliwebsite/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
use hira::hira;
use aws_s3::aws_s3;
use dotenv_reader::dotenv_reader;
use ::aws_cloudfront_distribution::s3_website_distribution::s3_website_distribution;

#[hira]
pub mod myvars {
use super::dotenv_reader;

pub mod outputs {
pub const ACM_ARN: &str = "this will be replaced by the value in the .env file. If not found, this string will be used as the default";
pub const MY_DOMAIN: &str = "hiracli.com";
}

pub fn config(inp: &mut dotenv_reader::Input) {
inp.dotenv_path = ".env".to_string();
}
}

#[hira]
pub mod hiradocs_bucket {
use super::aws_s3;
pub mod outputs {
pub use super::aws_s3::outputs::*;
}
pub fn config(inp: &mut aws_s3::Input) {
inp.is_website = true;
}
}

#[hira]
pub mod websitedistr {
use super::myvars::outputs::{ACM_ARN, MY_DOMAIN};
use super::hiradocs_bucket::outputs::LOGICAL_BUCKET_NAME;
use super::s3_website_distribution;
use self::s3_website_distribution::CustomDomainSettings;

pub fn config(distrinput: &mut s3_website_distribution::Input) {
distrinput.logical_bucket_website_url = LOGICAL_BUCKET_NAME.to_string();
distrinput.custom_domain_settings = Some(
CustomDomainSettings {
acm_arn: ACM_ARN.to_string(),
domain_name: MY_DOMAIN.to_string(),
subdomain: Some("docs".to_string()),
enable_route_53: false,
..Default::default()
}
);
}
}

0 comments on commit f08b19e

Please sign in to comment.