2.0.2 • Published 8 months ago

@bigbinary/neeto-custom-domains-frontend v2.0.2

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
8 months ago

neeto-custom-domains-nano

The neeto-custom-domains-nano manages custom domains across neeto applications.

Contents

  1. Development with Host application
  2. Instructions for publishing

Development with Host application

The engine provides the backend setup for neetoCustomDomains.

Installation

  1. Add this line to your application's Gemfile:
source "NEETO_GEM_SERVER_URL" do
  # ... existing gems

  gem "neeto-custom-domains-engine"
end
  1. And then execute:
bundle install
  1. Run migrations
rails neeto-custom-domains-engine:install:migrations
rails db:migrate

Usage

  1. Add association
class Organization > ApplicationRecord
  has_one :custom_domain, as: :custom_domainable, class_name:   "NeetoCustomDomainsEngine::Domain", dependent: :destroy
end
  1. Add controller

All common controller logic is extracted to the engine. However, we still need to load some records from the host app controller.

class Api::V1::Admin::CustomDomainsController < NeetoCustomDomainsEngine::DomainsController
  private

    def load_custom_domainable!
      @custom_domainable = organization.sites.find(params[:site_id])
    end

    def load_custom_domain!
      @custom_domain = @custom_domainable.custom_domain
    end
end
  1. Include the following module to your application's config/routes.rb file:
include NeetoCustomDomainsEngine::Routes::Draw
  1. Define required routes.
# config/routes.rb
custom_domains_routes :acme

# routes/admin.rb
 custom_domains_routes :domain
  1. Add frontend component. url should be the api to the custom domains controller.
import { CustomDomain as NeetoCustomDomainDashboard } from "@bigbinary/neeto-custom-domains-frontend";
import { BASE_API_V1_URL, SINGULAR } from "neetocommons/constants";
import HelpPopover from "neetomolecules/HelpPopover";
import { useTranslation } from "react-i18next";

import routes from "routes";
import { EVENTS } from "src/constants";
import { CUSTOM_DOMAIN_HELP_DOC_URL } from "src/constants/urls";

const CustomDomain = () => {
  const { t } = useTranslation();

  const breadcrumbs = [
    { link: routes.admin.settings.index, text: t("titles.settings") },
    {
      link: routes.admin.settings.customDomain,
      text: t("neetoCustomDomains.customDomain", SINGULAR),
    },
  ];

  const title = (
    <div className="flex items-center gap-x-2">
      {t("neetoCustomDomains.customDomain", SINGULAR)}
      <HelpPopover
        description={t("neetoCustomDomains.toolTips.customDomain")}
        helpLinkProps={{ href: CUSTOM_DOMAIN_HELP_DOC_URL }}
        popoverProps={{ position: "top" }}
        title={t("neetoCustomDomains.customDomain", SINGULAR)}
      />
    </div>
  );

  return (
    <div className="w-full">
      <NeetoCustomDomainDashboard
        headerProps={{ breadcrumbs, title }}
        url={`${BASE_API_V1_URL}/custom_domain`}
      />
    </div>
  );
};

export default CustomDomain;
  1. Mount the CustomDomain component at the desired apth.
ENV variables

For the working of this engine we need the following env variables.

LETS_ENCRYPT_PRIVATE_KEY: < For requesting SSL certificates >
LETS_ENCRYPT_DIRECTORY_URL: < For requesting SSL certificates >
LETS_ENCRYPT_APP_NAME: < For pushing SSL certificate and custom domains >
NEETO_DEPLOY_APP: < To identify in which platform the app is deployed NeetoDEploy/Heroku>
NEETO_DEPLOY_AUTH_TOKEN: <For pushing SSL certificate and custom domains>

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

9 months ago

1.2.0-beta-6

9 months ago

1.2.0-beta2

9 months ago

1.2.0-beta5

9 months ago

1.2.0-beta4

9 months ago

1.1.0

9 months ago