Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4e4c07

Browse files
committed
fix
1 parent5b9f6cb commita4e4c07

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

‎fastcaddy/_modidx.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@
2727
'fastcaddy.core.path2keys': ('core.html#path2keys','fastcaddy/core.py'),
2828
'fastcaddy.core.pcfg': ('core.html#pcfg','fastcaddy/core.py'),
2929
'fastcaddy.core.pid': ('core.html#pid','fastcaddy/core.py'),
30-
'fastcaddy.core.setup_caddy': ('core.html#setup_caddy','fastcaddy/core.py')}}}
30+
'fastcaddy.core.setup_caddy': ('core.html#setup_caddy','fastcaddy/core.py'),
31+
'fastcaddy.core.setup_pki_trust': ('core.html#setup_pki_trust','fastcaddy/core.py')}}}

‎fastcaddy/core.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# %% auto 0
66
__all__= ['automation_path','srvs_path','rts_path','get_id','get_path','gid','has_id','gcfg','has_path','pid','pcfg',
77
'nested_setdict','path2keys','keys2path','nested_setcfg','init_path','get_acme_config',
8-
'add_tls_internal_config','add_acme_config','init_routes','setup_caddy','add_route','del_id',
9-
'add_reverse_proxy','add_wildcard_route','add_sub_reverse_proxy']
8+
'add_tls_internal_config','add_acme_config','init_routes','setup_pki_trust','setup_caddy','add_route',
9+
'del_id','add_reverse_proxy','add_wildcard_route','add_sub_reverse_proxy']
1010

1111
# %% ../nbs/00_core.ipynb 3
1212
importos,subprocess,httpx,json
@@ -142,28 +142,36 @@ def init_routes(srv_name='srv0', skip=1):
142142
pcfg(ir,f"{srvs_path}/{srv_name}")
143143

144144
# %% ../nbs/00_core.ipynb 37
145+
defsetup_pki_trust(install_trust):
146+
"Configure PKI certificate authority trust installation"
147+
ifinstall_trustisNone:return
148+
pki_path='/apps/pki/certificate_authorities/local'
149+
init_path(pki_path,skip=1)
150+
pcfg({"install_trust":install_trust},pki_path)
151+
152+
# %% ../nbs/00_core.ipynb 38
145153
defsetup_caddy(
146154
cf_token=None,# Cloudflare API token
147155
srv_name='srv0',# Server name in the Caddyfile
148156
local:bool=False,# Whether or not this is for localdev or deployment
149-
skip_install_trust:bool=None):#Skip installingtrust store
157+
install_trust:bool=None):#Installtrust store?
150158
"Create SSL config and HTTP app skeleton"
151-
ifskip_install_trustisnotNone:pcfg(skip_install_trust,'/skip_install_trust',method='patch')
152159
iflocal:add_tls_internal_config()
153160
else:add_acme_config(cf_token)
161+
setup_pki_trust(install_trust)
154162
init_routes(srv_name)
155163

156-
# %% ../nbs/00_core.ipynb40
164+
# %% ../nbs/00_core.ipynb41
157165
defadd_route(route):
158166
"Add `route` dict to config"
159167
returnpcfg(route,rts_path)
160168

161-
# %% ../nbs/00_core.ipynb41
169+
# %% ../nbs/00_core.ipynb42
162170
defdel_id(id):
163171
"Delete route for `id` (e.g. a host)"
164172
xdelete(get_id(id))
165173

166-
# %% ../nbs/00_core.ipynb43
174+
# %% ../nbs/00_core.ipynb44
167175
defadd_reverse_proxy(from_host,to_url):
168176
"Create a reverse proxy handler"
169177
ifhas_id(from_host):del_id(from_host)
@@ -176,7 +184,7 @@ def add_reverse_proxy(from_host, to_url):
176184
}
177185
add_route(route)
178186

179-
# %% ../nbs/00_core.ipynb47
187+
# %% ../nbs/00_core.ipynb48
180188
defadd_wildcard_route(domain):
181189
"Add a wildcard subdomain"
182190
route= {
@@ -189,7 +197,7 @@ def add_wildcard_route(domain):
189197
}
190198
add_route(route)
191199

192-
# %% ../nbs/00_core.ipynb49
200+
# %% ../nbs/00_core.ipynb50
193201
defadd_sub_reverse_proxy(
194202
domain,
195203
subdomain,

‎nbs/00_core.ipynb‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,21 @@
475475
"init_routes()"
476476
]
477477
},
478+
{
479+
"cell_type":"code",
480+
"execution_count":null,
481+
"metadata": {},
482+
"outputs": [],
483+
"source": [
484+
"#| export\n",
485+
"def setup_pki_trust(install_trust):\n",
486+
"\"Configure PKI certificate authority trust installation\"\n",
487+
" if install_trust is None: return\n",
488+
" pki_path = '/apps/pki/certificate_authorities/local'\n",
489+
" init_path(pki_path, skip=1)\n",
490+
" pcfg({\"install_trust\": install_trust}, pki_path)"
491+
]
492+
},
478493
{
479494
"cell_type":"code",
480495
"execution_count":null,
@@ -486,11 +501,11 @@
486501
" cf_token=None, # Cloudflare API token\n",
487502
" srv_name='srv0', # Server name in the Caddyfile\n",
488503
" local:bool=False, # Whether or not this is for localdev or deployment\n",
489-
"skip_install_trust:bool=None): #Skip installingtrust store\n",
504+
"install_trust:bool=None): #Installtrust store?\n",
490505
"\"Create SSL config and HTTP app skeleton\"\n",
491-
" if skip_install_trust is not None: pcfg(skip_install_trust, '/skip_install_trust', method='patch')\n",
492506
" if local: add_tls_internal_config()\n",
493507
" else: add_acme_config(cf_token)\n",
508+
" setup_pki_trust(install_trust)\n",
494509
" init_routes(srv_name)"
495510
]
496511
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp